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
import sys

def better(A,B):
    if sum(A) > sum(B):
        return 1;
    elif sum(B) > sum(A):
        return 0;
    for i in range(10,0,-1):
        if A.count(i) > B.count(i):
            return 1;
        elif A.count(i) < B.count(i):
            return 0;
    return -1;

def main():
    data = sys.stdin.readlines()
    algo = list(map(int,data[0].split()))
    bajt = list(map(int,data[1].split()))
    if better(algo,bajt) == 1:
        print("Algosia")
    elif better(algo,bajt) == 0:
        print("Bajtek")
    else:
        print("remis")
    return 0;
    

if __name__ == "__main__":
    main()