#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ match(long long, long long, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int t;
  long long n, m;
  scanf("%d", &t);
  while (t--) {
    scanf("%lld %lld", &n, &m);
    puts(match((((n) > (m)) ? (n) : (m)), (((n) > (m)) ? (m) : (n)), 1)
             ? "Ari"
             : "Rich");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11fe <main+0xce>
lea    0xe97(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jle    1196 <main+0x66>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    119e <main+0x6e>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jle    11c1 <main+0x91>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    11c9 <main+0x99>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    $0x1,%edx
call   1040 <match@plt>
mov    %rax,%rcx
lea    0xe2c(%rip),%rdi
lea    0xe21(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdi
call   1030 <puts@plt>
jmp    1151 <main+0x21>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
lea    0xebc(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
subl   $0x1,0xc(%rsp)
jb     11c8 <main+0x98>
lea    0xea5(%rip),%r14
lea    0x18(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xea2(%rip),%r13
lea    0xe97(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x18(%rsp),%rsi
mov    0x10(%rsp),%rax
cmp    %rax,%rsi
mov    %rax,%rdi
cmovg  %rsi,%rdi
cmovg  %rax,%rsi
mov    $0x1,%edx
call   1040 <match@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r13,%rdi
call   1030 <puts@plt>
subl   $0x1,0xc(%rsp)
jae    1180 <main+0x50>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [10 x i8] c"%lld %lld\00"
@.str.2 = [4 x i8] c"Ari\00"
@.str.3 = [5 x i8] c"Rich\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %6
6: ; preds = %28, %0
%7 = load i32, i32* %2
%8 = add nsw i32 %7, -1
store i32 %8, i32* %2
%9 = icmp ne i32 %7, 0
br i1 %9, label %10, label %35
10: ; preds = %6
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64* %3, i64* %4)
%12 = load i64, i64* %3
%13 = load i64, i64* %4
%14 = icmp sgt i64 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = load i64, i64* %3
br label %19
17: ; preds = %10
%18 = load i64, i64* %4
br label %19
19: ; preds = %17, %15
%20 = phi i64 [ %16, %15 ], [ %18, %17 ]
%21 = load i64, i64* %3
%22 = load i64, i64* %4
%23 = icmp sgt i64 %21, %22
br i1 %23, label %24, label %26
24: ; preds = %19
%25 = load i64, i64* %4
br label %28
26: ; preds = %19
%27 = load i64, i64* %3
br label %28
28: ; preds = %26, %24
%29 = phi i64 [ %25, %24 ], [ %27, %26 ]
%30 = call i64 @match(i64 %20, i64 %29, i32 1)
%31 = icmp ne i64 %30, 0
%32 = zext i1 %31 to i64
%33 = select i1 %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%34 = call i32 @puts(i8* %33)
br label %6
35: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [10 x i8] c"%lld %lld\00"
@.str.2 = [4 x i8] c"Ari\00"
@.str.3 = [5 x i8] c"Rich\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = bitcast i32* %1 to i8*
%5 = bitcast i64* %2 to i8*
%6 = bitcast i64* %3 to i8*
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = add nsw i32 %8, -1
store i32 %9, i32* %1
%10 = icmp eq i32 %8, 0
br i1 %10, label %25, label %11
11: ; preds = %0, %11
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64* %2, i64* %3)
%13 = load i64, i64* %2
%14 = load i64, i64* %3
%15 = icmp sgt i64 %13, %14
%16 = select i1 %15, i64 %13, i64 %14
%17 = select i1 %15, i64 %14, i64 %13
%18 = call i64 @match(i64 %16, i64 %17, i32 1)
%19 = icmp eq i64 %18, 0
%20 = select i1 %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%21 = call i32 @puts(i8* dereferenceable(1) %20)
%22 = load i32, i32* %1
%23 = add nsw i32 %22, -1
store i32 %23, i32* %1
%24 = icmp eq i32 %22, 0
br i1 %24, label %25, label %11
25: ; preds = %11, %0
ret i32 0
}