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

def read_int_list():
    return list(map(int, [x for x in sys.stdin.readline().strip().split(' ') if x != '']))

if __name__=='__main__':
    A = read_int_list()
    B = read_int_list()

    a_won = False
    b_won = False

    if sum(A) > sum(B):
        a_won = True
    elif sum(A) < sum(B):
        b_won = True
    else:    
        for n in range(10, -1, -1):
            if A.count(n) > B.count(n):
                a_won = True
                break
            elif A.count(n) < B.count(n):
                b_won = True
                break
    
    print("Algosia" if a_won else "Bajtek" if b_won else "remis")