QOJ.ac

QOJ

Time Limit: 2.0 s Memory Limit: 1024 MB Hackable ✓

# 8722. 卡牌游戏

Statistics

Alice and Bob are playing a card game.

Each card is labeled with a number from 1 to N. Alice has Ai cards labeled with number i, and Bob has Bi cards labeled with number i.

The game consists of several rounds. In each round, the winner of the previous round starts (if it is the first round, Alice starts). Players take turns making the following decisions:

  • Play a Card: Choose a card that has the same number as the card played in the previous turn of the current round. If no card has been played yet in the current round, any card can be chosen.
  • Pass: Choose to pass, ending the current round. The opponent then wins the current round. Note that if no card has been played yet in the current round, you cannot choose to pass.

At any point, if a player has played all their cards, that player wins the entire game, and the game ends.

There are T independent queries. For each query, assuming both Alice and Bob know each other's cards and both play optimally, determine who will win the game.

Input

  • The first line contains an integer T (1 ≤ T ≤ 106), the number of queries.
  • Each query consists of the following:
    • The first line contains an integer N (1 ≤ N ≤ 106).
    • The second line contains N integers A1, A2, ..., AN (0 ≤ Ai ≤ 109, at least one Ai > 0).
    • The third line contains N integers B1, B2, ..., BN (0 ≤ Bi ≤ 109, at least one Bi > 0).

It is guaranteed that the total sum of N across all queries does not exceed 106.

Output

For each query, output a single line containing either "Alice" if Alice wins the game or "Bob" if Bob wins the game.

Example

Input:

5
1
100
100
2
1 1
1 1
2
1 1
0 1
3
114
514
10
116 104 101 114 101 32 97 114 101 32
102 105 118 101 32 99 97 115 101 115

Output:

Alice
Bob
Alice
Alice
Alice

Explanation

  • First Query: One possible game sequence is as follows: Alice and Bob alternately play cards labeled 1. Alice plays the last card when Bob still has one card remaining, thus Alice wins the game.

  • Second Query: One possible game sequence is as follows: Alice plays a card labeled 1, Bob plays a card labeled 1, Alice passes, and Bob wins the first round. Then, Bob plays the last card labeled 2, winning the game.