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
from sys import *
alg=[int(x) for x in input().split()]
baj=[int(x) for x in input().split()]
ila=[0]*11
ilb=[0]*11
x=sum(alg)
y=sum(baj)
if x>y:
    print("Algosia")
    exit()
if x<y:
    print("Bajtek")
    exit()
else:
    for i in range(17,-1,-1):
        ila[alg[i]]+=1
        ilb[baj[i]]+=1
    #print(ila,"\n",ilb)
    for i in range(10,0,-1):
        if ila[i]>ilb[i]:
            print("Algosia")
            exit()
        if ilb[i]>ila[i]:
            print("Bajtek")
            exit()
    if i==1:
        print("remis")
        exit()