about summary refs log tree commit diff
path: root/codechef/matchs.c
blob: 78313789b9029e68ea90f62ff163735ede3f350e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>
#define MAX(x, y) (((n) > (m)) ? (n) : (m))
#define MIN(x, y) (((n) > (m)) ? (m) : (n))

int match(long long x, long long y, int ari)
{
	long long mod = x % y;
	return (mod && x - y == mod) ? match(y, mod, !ari) : ari;
}

int main()
{
	int t;
	long long n, m;

	scanf("%d", &t);
	while (t--) {
		scanf("%lld %lld", &n, &m);
		puts(match(MAX(n, m), MIN(n, m), 1) ? "Ari" : "Rich");
	}

	return 0;
}