P10029 "Cfz Round 3" Battle

Description

Alice and Bob are playing a game with the following rules: - Alice initially has an integer $n$, and Bob initially has an integer $m$. - Starting from Alice, the two players take turns operating on **the integer owned by the other player**. Let the integer currently owned by the other player be $h$. Change $h$ by **subtracting** $h \bmod p$ from it, where $\bmod$ denotes the **modulo** operation, and $p$ is a given constant. - The first player who makes the other player's integer become $0$ wins. If no one wins after each of them has made $10^{10^{9961}}$ moves, the game is considered a draw. You need to determine who will win, or report that the game will end in a draw.

Input Format

**This problem has multiple test cases.** The first line contains an integer $T$, representing the number of test cases. Then follow the test cases. For each test case, three integers $n, m, p$ are given.

Output Format

For each test case, output one string per line as the answer: - If Alice will win, output `Alice`. - If Bob will win, output `Bob`. - If the game will be a draw, output `Lasting Battle`.

Explanation/Hint

#### "Sample Explanation #1" For the $1$st test case, in her first move, Alice changes Bob's integer from $2$ to $2-(2\bmod 10)$, which is $0$, so Alice will win. For the $2$nd test case, in her first move, Alice changes Bob's integer from $11$ to $11-(11\bmod 11)$, which is $11$. In Bob's first move, he changes Alice's integer from $9$ to $9-(9 \bmod 11)$, which is $0$, so Bob will win. For the $3$rd test case, it can be proven that the game will be a draw. #### "Constraints" For all testdata, $1 \leq T \leq 5000$, $1 \leq n, m, p \leq 2\times 10^9$. **Only if you pass all test points of this problem can you get the score for this problem.** Translated by ChatGPT 5