AtCoder Regular Contest 185
A
mod M Game 2
AtCoder
⌀ 1042
原题
←B →
翻译中…

Problem Statement

翻译中…

There are positive integers $N$ and $M$, where $N \lt M$. Alice and Bob will play a game. Each player has $N$ cards with $1, 2, \dots, N$ written on them, one for each number. Starting with Alice, the two players take turns repeatedly performing this action: choose one card from their hand and play it onto the table. Immediately after a card is played onto the table, if the sum of the numbers on the cards that have been played so far is divisible by $M$, the player who just played the card loses, and the other player wins. If both players play all their cards without satisfying the above condition, Alice wins. Who will win, Alice or Bob, when both play optimally?

翻译中…

You are given $T$ test cases. Solve each of them.

翻译中…

Constraints

翻译中…
  • $1 \leq T \leq 10^5$
  • $1 \leq N \lt M \leq 10^9$
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format. Here, $\mathrm{case}_i$ denotes the $i$-th test case.

翻译中…

T
\mathrm{case}_1
\mathrm{case}_2
\vdots
\mathrm{case}_T

翻译中…

Each test case is given in the following format:

翻译中…

N M

翻译中…

Output

翻译中…

Print $T$ lines. The $i$-th line should contain the answer for the $i$-th test case. For each test case, if Alice wins when both play optimally, print Alice; if Bob wins, print Bob.

翻译中…

样例

Input #1
8
2 3
3 6
5 9
45 58
39 94
36 54
74 80
61 95
Output #1
Alice
Alice
Bob
Bob
Alice
Bob
Bob
Alice
In the first test case, the game could proceed as follows. - Initially, both Alice and Bob have two cards: the card with $1$ and the card with $2$. - Alice plays the card with $1$. - The sum of the numbers on the cards played so far is $1$, which is not divisible by $3$, so Alice does not lose. - Bob plays the card with $1$. - The sum is now $2$, which is not divisible by $3$, so Bob does not lose. - Alice plays the card with $2$. - The sum is now $4$, which is not divisible by $3$, so Alice does not lose. - Bob plays the card with $2$. - The sum is now $6$, which is divisible by $3$, so Bob loses and Alice wins. In the first test case, no matter how Bob plays, Alice can win.
题目信息
题号
arc185_a
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。