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
32
33
34
35
wynik = input()
algosia = [int(x) for x in wynik.split()]

wynik = input()
bajtek = [int(x) for x in wynik.split()]

bajtek_suma = 0
algosia_suma = 0
bajtek_dic = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0}
algosia_dic = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0}

for num in bajtek:
    bajtek_suma += num
    bajtek_dic[num] += 1
for num in algosia:
    algosia_suma += num
    algosia_dic[num] += 1

def output():
    if algosia_suma > bajtek_suma:
        return "Algosia"
    elif bajtek_suma > algosia_suma:
        return "Bajtek"
    else:
        for i in range(10, -1, -1):
            if bajtek_dic[i] == algosia_dic[i]:
                continue
            elif bajtek_dic[i] > algosia_dic[i]:
                return "Bajtek"
            else:
                return "Algosia"
        return "remis"


print(output())