1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
alg = input().split()
baj = input().split()
alg = [int(i) for i in alg]
baj = [int(i) for i in baj]
wynik = [0 for _ in range(0, 11)]
alg_sum = sum(alg)
baj_sum = sum(baj)
def find_winner():
    for i in range(18):
        wynik[baj[i]] += 1
        wynik[alg[i]] -= 1
    for i in range(10,-1,-1):
        if wynik[i] < 0:
            return "Algosia"
        elif wynik[i] > 0:
            return "Bajtek"
    return "remis"

if alg_sum > baj_sum:
    print("Algosia")
elif alg_sum < baj_sum:
    print("Bajtek")
else:
    print(find_winner())