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
39
40
41
42
43
44
45
46
47
import sys


def count_scores(scores):
    counter = [0 for _ in range(10 + 1)]
    for x in scores:
        assert 0 <= x <= 10
        counter[x] += 1
    return tuple(reversed(counter))


def cmp(scores1, scores2):
    s1 = sum(scores1)
    s2 = sum(scores2)
    if s1 < s2:
        return -1
    if s1 > s2:
        return 1
    if s1 == s2:
        c1 = count_scores(scores1)
        c2 = count_scores(scores2)
        if c1 < c2:
            return -1
        if c1 > c2:
            return 1
        if c1 == c2:
            return 0
        assert False
    assert False


def main():
    algosia = [int(s) for s in sys.stdin.readline().split()]
    bajtek = [int(s) for s in sys.stdin.readline().split()]
    x = cmp(algosia, bajtek)
    if x == 0:
        print('remis')
    elif x == 1:
        print('Algosia')
    elif x == -1:
        print('Bajtek')
    else:
        assert False


if __name__ == "__main__":
    main()