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
39
40
41
42
43
44
45
a = input()
a = [int(i) for i in a.split()]

b = input()
b = [int(i) for i in b.split()]


def compare(a,b):
    aa=sum(a)
    bb=sum(b)
    if aa!=bb:
        return "Algosia"*int(aa>bb)+"Bajtek"*int(aa<bb)
    
    ca = {}
    cb = {}
    for i in a:
        if i in ca.keys():
            ca[i]+=1 
        else:
            ca[i]=1
    for i in range(11):
        if i not in ca.keys():
            ca[i]=0
    
    for i in b:
        if i in cb.keys():
            ca[i]+=1 
        else:
            ca[i]=1
            
    for i in range(11):
        if i not in cb.keys():
            cb[i]=0
            
    if ca==cb:
        return "remis"
    
    for i in range(11):
        aa=ca[10-i]
        bb=cb[10-i]
        if aa!=bb:
            return "Algosia"*int(aa>bb)+"Bajtek"*int(aa<bb)
            
    
print(compare(a,b))