题目描述
Problem Description
There are $ N $ rooted trees. Each tree is named Tree $ 1 $, Tree $ 2 $, $\ldots$, Tree $ N $. Tree $ i $ has $ M_i $ vertices, named Vertex $ 1 $, Vertex $ 2 $, $\ldots$, Vertex $ M_i $. The root of Tree $ i $ is Vertex $ 1 $, and the parent of Vertex $ j $ $(2 \leq j \leq M_i)$ in Tree $ i $ is Vertex $ p_{ij} $.
Alice and Bob are going to play a game using these trees and one chess piece. The rules are as follows:
- Initially, the piece is placed at the "starting point".
- Players take turns, starting with Alice.
- If the piece is at the "starting point", the current player chooses one of the trees that has not been selected yet and moves the piece to the root of that tree. If there are no unselected trees left, the current player loses.
- If the piece is at a leaf of a tree, move the piece back to the "starting point".
- If the piece is at a vertex that is not a leaf, move the piece to one of its child vertices.
When Alice and Bob play optimally to win, who will win?
Input Format
The input is given from the standard input in the following format:
$ N $ $ M_1 $ $ p_{12} $ $ p_{13} $ $ ... $ $ p_{1{M_1}} $ $ M_2 $ $ p_{22} $ $ p_{23} $ $ ... $ $ p_{2{M_2}} $ $\vdots$ $ M_N $ $ p_{N2} $ $ p_{N3} $ $ ... $ $ p_{N{M_N}} $
Output Format
Output Alice if Alice wins when both players play optimally, or Bob if Bob wins.
Sample Input and Output
Sample Input #1
1
4
1 1 2
Sample Output #1
Bob
Sample Input #2
3
5
1 2 3 4
5
1 2 1 4
10
1 1 1 3 4 2 3 5 6
Sample Output #2
Bob
Notes/Hints
Constraints
- $1 \leq N \leq 10^5$
- $2 \leq M_i \leq 10^5$
- $1 \leq p_{ij} \leq j-1$
- $\sum_{i=1}^{N} M_i \leq 2 \times 10^5$
Sample Explanation 1
The players take the following actions:
- Alice moves the piece to the root of Tree $ 1 $, which is Vertex $ 1 $.
- Bob moves the piece to Vertex $ 2 $, which is a child of Vertex $ 1 $.
- Alice moves the piece to Vertex $ 4 $, which is a child of Vertex $ 2 $.
- Bob moves the piece back to the starting point because Vertex $ 4 $ is a leaf.
After this, Alice cannot move the piece anymore, so Bob wins.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分