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
a=list(map(int,input().split()))
b=list(map(int,input().split()))
if (sum(a) > sum(b)):
    print("Algosia")
elif (sum(b) > sum(a)):
    print("Bajtek")
else:
    cnta = [0]*11
    cntb = [0]*11
    for i in range(18):
        cnta[a[i]]+=1
        cntb[b[i]]+=1
    x = 1
    f = 1
    while cnta[-x]==cntb[-x]:
        x+=1
        if x == 11:
            f = 0
            break
    if not f:
        print("remis")
    else:
        if cnta[-x] > cntb[-x]:
            print("Algosia")
        elif cnta[-x] < cntb[-x]:
            print("Bajtek")
        else:
            print("remis")