1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
a=list(map(int, input().split()))
b=list(map(int, input().split()))

sumA=0
nA = [0,0,0,0,0,0,0,0,0,0,0]
for i in a:
    sumA += i
    nA[i] += 1

sumB=0
nB = [0,0,0,0,0,0,0,0,0,0,0]
for i in b:
    sumB += i
    nB[i] += 1

if (sumA>sumB):
    print("Algosia")
    exit()
elif (sumB>sumA):
    print("Bajtek")
    exit()
else:
    for p in range(11):
        if (nA[10-p]>nB[10-p]):
            print("Algosia")
            exit()
        elif (nB[10-p]>nA[10-p]):
            print("Bajtek")
            exit()
    print("Remis")