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
36
37
38
line1 = input()
line2 = input()

line1 = list(map(int, line1.split(" ")))
line2 = list(map(int, line2.split(" ")))

from collections import Counter

counter1 = Counter(line1)
counter2 = Counter(line2)

s1 = sum(counter1.values())
s2 = sum(counter2.values())

result = ""

if s1 > s2:
    result = "Algosia"
elif s1 < s2:
    result = "Bajtek"
else:
    for v in reversed(range(1,11)):
        ss1 = 0
        ss2 = 0
        if v in counter1:
            ss1 = counter1[v]
        if v in counter2:
            ss2 = counter2[v]
        if ss1 > ss2:
            result = "Algosia"
            break
        elif ss1 < ss2:
            result = "Bajtek"
            break
    if result == "":
        result = "remis"

print(result)