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
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]

total_a, total_b = sum(a), sum(b)
score_a, score_b = [0]*11, [0]*11

for x in a:
    score_a[x] += 1

for x in b:
    score_b[x] += 1

if total_a > total_b:
    print("Algosia")
elif total_a < total_b:
    print("Bajtek")
else:
    for i in range(10,0,-1):
        if score_a[i] > score_b[i]:
            print("Algosia")
            exit(0)
        elif score_a[i] < score_b[i]:
            print("Bajtek")
            exit(0)
    print("remis")