QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 512 MB Points totaux : 100

#16523. Battle

Statistiques

Alice and Bob are playing a game with the following rules:

  • Alice starts with an integer $n$, and Bob starts with an integer $m$.
  • Starting with Alice, the two players take turns performing an operation on the integer held by the opponent: let the integer currently held by the opponent be $h$, replace $h$ with $h - (h \bmod p)$, where $\bmod$ denotes the modulo operation and $p$ is a given constant.
  • The first player to make the opponent's integer $0$ wins. If neither player has won after each has performed $10^{10^{9961}}$ operations, the game is considered a draw.

You need to determine who will win, or report if the game will end in a draw.

Input

This problem contains multiple test cases.

The first line contains an integer $T$, representing the number of test cases.

Each test case consists of three integers $n, m, p$.

Output

For each test case, output a single string on a new line:

  • If Alice will win, output Alice.
  • If Bob will win, output Bob.
  • If the game will end in a draw, output Lasting Battle.

Examples

Input 1

3
1 2 10
9 11 11
55 15 14

Output 1

Alice
Bob
Lasting Battle

Note 1

For the first test case, Alice will change the integer Bob holds from $2$ to $2 - (2 \bmod 10) = 0$ in her first turn, so Alice wins.

For the second test case, Alice will change the integer Bob holds from $11$ to $11 - (11 \bmod 11) = 11$ in her first turn, and Bob will change the integer Alice holds from $9$ to $9 - (9 \bmod 11) = 0$ in his first turn, so Bob wins.

For the third test case, it can be proven that the game will end in a draw.

Constraints

For all test cases, $1 \leq T \leq 5000$, $1 \leq n, m, p \leq 2\times 10^9$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.