#P11072. Alice and Bob

Alice and Bob

Problem Description

Alice and Bob are playing a game together.

At the beginning, you are given an integer sequence aa with values in the range from 00 to nn. Then they take turns performing the following operation, with Alice moving first.

  • Operation: arbitrarily rearrange a1a1a_{1\sim a_1}.

If, before a player's move, a1=0a_1=0, then that player loses immediately, because they cannot make a move.

If, after some move, a player has two of their own moves such that after those moves the resulting a1a_1 values are the same, then that player loses immediately.

Now you are given a non-negative integer sequence aa. Assuming both players are smart enough, determine who has a winning strategy.

Input Format

This problem has multiple test cases.

The first line contains a positive integer TT, the number of test cases.

Then follow TT test cases. For each test case, the first line contains a positive integer nn, and the second line contains nn non-negative integers aia_i.

Output Format

For each test case, output one line with a string Alice or Bob, indicating that the first player wins or the second player wins, respectively.

4
2
2 1
2
2 0
3
1 2 3
3
0 1 1
Bob
Alice
Bob
Bob

Hint

Test point ID idid n=n= Special property
1201\sim 20 idid None
2121 2020 a1=0a_1=0
2222 a1=1a_1=1
2323 All aia_i are the same
242524\sim 25 All aia_i are pairwise distinct

For all testdata, it is guaranteed that 1T,n201\le T,n\le 20, 0ain0\le a_i\le n.

Translated by ChatGPT 5