题目描述
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Ari and Rich are playing a pretty confusing game. Here are the rules of the game:
The game is played with two piles of matches. Initially, the first pile contains $N$ matches and the second one contains $M$ matches.
The players alternate turns; Ari plays first.
On each turn, the current player must choose one pile and remove a positive number of matches (not exceeding the current number of matches on that pile) from it.
It is only allowed to remove $X$ matches from a pile if the number of matches in the other pile divides $X$.
The player that takes the last match from any pile wins.
It can be proved that as long as both piles are non-empty, there is always at least one valid move, so the game must end by emptying some pile. Both Ari and Rich play optimally. Determine the winner of the game.
------ Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first and only line of each test case contains two space-separated integers $N$ and $M$.
------ Output ------
For each test case, print a single line containing the string "Ari" (without quotes) if Ari wins or "Rich" (without quotes) if Rich wins.
------ Constraints ------
$1 ≤ T ≤ 10^{5}$
$1 ≤ N, M ≤ 10^{18}$
------ Subtasks ------
Subtask #1 (30 points): $1 ≤ N, M ≤ 1,000$
Subtask #2 (70 points): original constraints
----- Sample Input 1 ------
5
1 1
2 2
1 3
155 47
6 4
----- Sample Output 1 ------
Ari
Ari
Ari
Ari
Rich
----- explanation 1 ------
One possible sequence of moves for the fourth test case is:
$(155, 47) \rightarrow (61, 47) \rightarrow (14, 47) \rightarrow (14, 19) \rightarrow (14, 5) \rightarrow (4, 5) \rightarrow (4, 1) \rightarrow (0, 1)$
输入格式
见题面
输出格式
见题面