1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
from collections import Counter

def get_input():
    return [int(x) for x in input().split(' ')]

def get_vec(l):
    l_count = Counter(l)
    return tuple([sum(l)] + [l_count[i] for i in range(10, -1, -1)])

a = get_input()
b = get_input()

a_vec = get_vec(a)
b_vec = get_vec(b)

if a_vec > b_vec:
    print('Algosia')
elif b_vec > a_vec:
    print('Bajtek')
else:
    print('remis')