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
def main():
    a=list(map(int,input().split()))
    b=list(map(int,input().split()))
    n=0
    m=0
    da=[0 for i in range(11)]
    db=[0 for i in range(11)]
    for i in range(18):
        da[a[i]]+=1
        db[b[i]]+=1
        n+=a[i]
        m+=b[i]
    if n>m:
        print("Algosia")
    elif m>n:
        print("Bajtek")
    else:
        g=2
        for i in reversed(range(11)):
            if da[i]>db[i]:
                g=1
                break
            elif db[i]>da[i]:
                g=0
                break
        if g==2:
            print("remis")
        elif g==1:
            print("Algosia")
        else:
            print("Bajtek")
main()