Take Up to K
Alice and Bob found a jar of n marbles on the porch and, naturally, turned it into a game. They
take turns, and Alice goes first. On each turn the current player must remove at least 1 and at
most k marbles from the jar, and never more than are left. Whoever removes the last marble keeps
the whole jar and wins. Both of them play perfectly.
For each game, tell who wins. If Alice wins, also tell how many marbles she should take on her very first turn so that she still wins against Bob's best play. It can be shown that this number is unique.
Input
The first line contains an integer t (1 ≤ t ≤ 10^5), the number of games.
Each of the next t lines contains two integers n and k (1 ≤ n ≤ 10^18, 1 ≤ k ≤ 10^18), the
number of marbles in the jar and the maximum number of marbles that may be taken in one turn.
Output
For each game print one line. If Bob wins, print Bob. Otherwise print Alice, a space, and the
number x (1 ≤ x ≤ min(n, k)) of marbles Alice must take on her first turn to guarantee the win.
Notes
In the first example, in the first game (n = 5, k = 2) Alice takes 2 marbles and leaves 3.
Bob takes 1 or 2 of them, and Alice takes the rest. In the second game (n = 6, k = 2), any
first move by Alice leaves 5 or 4 marbles. Bob can then take enough to leave exactly 3 for
Alice, and she loses as above.
In the second example, k ≥ n in the first game, so Alice simply empties the jar.