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
31
import sys


def kto(a, b):
    sa = sum(a)
    sb = sum(b)
    if sa != sb:
        return sb - sa
    ta = [0] * 11
    tb = [0] * 11
    for i in range(18):
        ta[a[i]] += 1
        tb[b[i]] += 1
    for i in range(10, 0, -1):
        if ta[i] > tb[i]:
            return -1
        elif ta[i] < tb[i]:
            return 1
    return 0


a = list(map(int, sys.stdin.readline().split()))
b = list(map(int, sys.stdin.readline().split()))

r = kto(a, b)
if r < 0:
    print('Algosia')
elif r > 0:
    print('Bajtek')
else:
    print('remis')