AT_arc208_e [ARC208E] XY Game
Description
You are given positive integers $ N $ , $ X $ , $ Y $ and a length- $ N $ integer sequence $ A=(A_1,A_2,\ldots,A_N) $ .
There are $ N $ piles of stones, and the $ i $ -th pile $ (1\le i\le N) $ has $ A_i $ stones.
Alice and Bob will play the following game using these piles:
- Starting with Alice, the two players take turns alternately.
- In each turn, the player chooses one non-empty pile and removes one or two stones from that pile. However, the player cannot make a move such that the number of stones in that pile becomes a multiple of $ X $ or a multiple of $ Y $ after removing stones.
The player who cannot make a move first loses.
Determine which player wins when both players play optimally.
You are given $ T $ test cases, solve each of them.
Input Format
The input is given from Standard Input in the following format:
> $ T $ $ \text{case}_1 $ $ \text{case}_2 $ $ \vdots $ $ \text{case}_T $
Each test case is given in the following format:
> $ N $ $ X $ $ Y $ $ A_1 $ $ A_2 $ $ \ldots $ $ A_N $
Output Format
Output the answers for each test case in order, separated by newlines.
For each test case, print `Alice` if Alice wins when both players play optimally, and `Bob` if Bob wins.
Explanation/Hint
### Sample Explanation 1
Consider the first test case.
For example, the game proceeds as follows:
- Alice removes two stones from the first pile. The first pile has two stones remaining.
- Bob removes one stone from the second pile. The second pile has eleven stones remaining.
- Alice removes one stone from the first pile. The first pile has one stone remaining.
- Bob cannot make a move, so Bob loses and Alice wins.
In this test case, Alice always wins no matter how both players make their moves. Therefore, print `Alice` on the first line.
### Constraints
- $ 1\le T \le 2\times 10^5 $
- $ 1\le N \le 2\times 10^5 $
- The sum of $ N $ over all test cases is at most $ 2\times 10^5 $ .
- $ 1\le X < Y\le 10^9 $
- $ 1\le A_i \le 10^{18} $
- All input values are integers.