Hide

Problem D
Yet Another Game of Stones

Alice and Bob are playing yet another game of stones. The rules of this game are as follow:

  • The game starts with $n$ piles of stones indexed from $1$ to $n$. The $i$-th pile contains $a_ i$ stones and a special constraint indicated as $b_ i$.

  • The players make their moves alternatively. The allowable moves for the two players are different.

  • An allowable move of Bob is considered as removal of some positive number of stones from a single pile.

  • An allowable move of Alice is also considered as removal of some positive number of stones from a single pile, but is limited by the constraint $b_ i$ of that pile.

    • If $b_ i=0$, there are no constraints.

    • If $b_ i=1$, Alice can only remove some odd number of stones from that pile.

    • If $b_ i=2$, Alice can only remove some positive even number of stones from that pile.

    Please note that there are no constraints on Bob.

  • The player who is unable to make an allowable move loses.

Alice is always the first to make a move. Do you know who will win the game if they both play optimally?

Input

There are multiple test cases. The first line of input contains an integer $T$, indicating the number of test cases. Each test case is described by 3 lines:

  • The first line of each test case contains an integer $n$ ($1 \le n \le 10^5$), indicating the number of piles.

  • The second line of each test case contains $n$ integers $a_1,a_2,\dots ,a_ n$ ($1 \le a_ i \le 10^9$), indicating the number of stones in each pile.

  • The third line of each test case contains $n$ integers $b_1,b_2,\dots ,b_ n$ ($0 \le b_ i \le 2$), indicating the special constraint the corresponding.

It is guaranteed that the sum of $n$ over all test cases does not exceed $10^6$.

We kindly remind you that this problem contains large I/O file, so it is recommended to use a faster I/O method. For example, you can use scanf/printf instead of cin/cout in C++.

Output

For each test case, output “Alice” (without the quotes) if Alice will win the game. Otherwise, output “Bob” (without the quotes).

Sample Input 1 Sample Output 1
3
2
4 1
1 0
1
3
2
1
1
2
Alice
Bob
Bob

Please log in to submit a solution to this problem

Log in