Sum Game
Обмеження: 2 сек., 512 МіБ
Ana and Bob play the following game.
First, Bob chooses a sequence of \(n\) positive integers \(a_1, a_2, \dots, a_n\). Then Ana is allowed to perform the following operations.
She may erase any of the numbers from the sequence, but she is not allowed to erase all of them (at least one number must remain).
For each remaining number, she may put either a
+or a-sign in front of it.
After that, Ana computes the sum of the remaining numbers. She wins the game if she can obtain a sum that is divisible by \(m\). Otherwise, Bob wins.
Given \(n\) and \(m\), determine which player has a winning strategy.
Вхідні дані
The first line contains a single integer \(t\) – the number of test cases.
Each of the next \(t\) lines contains two integers \(n\) and \(m\).
Вихідні дані
For each test case, output a single line.
Ana– if Ana has a winning strategy,Bob– if Bob has a winning strategy.
Обмеження
\(1 \le t \le 10^5\),
\(1 \le n, m \le 10^{18}\).
Приклади
| Вхідні дані (stdin) | Вихідні дані (stdout) |
|---|---|
| 3 1 2 2 3 3 8 | Bob Ana Bob |
Примітки
In the first test case, Bob can choose \(a_1 = 3\).
In the second test case, no matter how Bob chooses \(a_1, a_2\), Ana has a winning strategy.
Надіслати розв'язок
| Element Type | Створено | Хто | Задача | Компілятор | Результат | Час (сек.) | Пам'ять (МіБ) | № | Дії |
|---|
| Element Type | Створено | Хто | Задача | Компілятор | Результат | Час (сек.) | Пам'ять (МіБ) | № | Дії |
|---|