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
# 10 10 7 10 10 10 10 10 10 10 10 10 0 10 4 10 10 10
# 10 10 10 10 10 10 10 10 10 10 10 10 4 3 4 10 10 10


from collections import defaultdict

result = "remis"
algosiaItems = list(map(int, input().split()))
bajtekItems = list(map(int, input().split()))

aSum = sum(algosiaItems)
bSum = sum(bajtekItems)

dictA = defaultdict(int)
dictB = defaultdict(int)

if aSum > bSum:
    result = "Algosia"
elif bSum > aSum:
    result = "Bajtek"
else:
    for i in range(1, 11):
        aItem = algosiaItems[i]
        bItem = bajtekItems[i]
        dictA[aItem] += 1
        dictB[bItem] += 1

    for i in range(10, -1, -1):
        if dictA[i] > dictB[i]:
            result = "Algosia"
            break
        elif dictB[i] > dictA[i]:
            result = "Bajtek"

print(result)