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 groupScores(scores):
    d = {}
    for i in range(11):
        d[i] = 0
    for score in scores:
        d[score] += 1
    return d


def compare(a, b):
    if sum(a) != sum(b):
        if sum(a) > sum(b):
            print('Algosia')
            return
        else:
            print('Bajtek')
            return

    scoresA = groupScores(a)
    scoresB = groupScores(b)
    for i in range(10, -1, -1):
        if scoresA[i] != scoresB[i]:
            if scoresA[i] > scoresB[i]:
                print('Algosia')
                return
            else:
                print('Bajtek')
                return
    print('remis')


a = list(map(int, input().split()))
b = list(map(int, input().split()))

# a = [6, 6]
# b = [6, 6]

compare(a, b)