1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
a = input().split(" ")
b = input().split(" ")
sum_a, sum_b, count_a, count_b = 0, 0, [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

for i in range(0, 18):
    sum_a += int(a[i])
    sum_b += int(b[i])
    count_a[int(a[i])] += 1
    count_b[int(b[i])] += 1

if sum_a > sum_b:
    print("Algosia")
elif sum_a < sum_b:
    print("Bajtek")
else:
    for i in range(11, -1, -1):
        if count_a[i] > count_b[i]:
            print("Algosia")
            break
        elif count_a[i] < count_b[i]:
            print("Bajtek")
            break
        if i == -1:
            print("remis")