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
def tablica(tablica):   
    tablica = tablica.split()
    for i in range(len(tablica)):
        tablica[i] = int(tablica[i])
    return(tablica)

def main(Algosia, Bajtek):
    tabA = [0,0,0,0,0,0,0,0,0,0,0]
    tabB = [0,0,0,0,0,0,0,0,0,0,0]
    sumaA = 0
    sumaB = 0
    Algosia = tablica(Algosia)
    Bajtek = tablica(Bajtek)
    for i in Algosia:
        sumaA += i
        tabA[i]+=1
    for i in Bajtek:
        sumaB+= i
        tabB[i]+= 1
    if (sumaA>sumaB):
        print("Algosia")
    elif (sumaA<sumaB):
        print("Bajtek")
    else:
        for i in range(10):
            j = 10
            k = j-i
            if (tabA[k]==tabB[k]):
                continue
            elif (tabA[k]>tabB[k]):
                print("Algosia")
            else:
                print("Bajtek")
        print("remis")


if __name__ == '__main__':  
    main(input(),input())