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
#!/usr/bin/env python3

import sys


def main():
    score = []
    count = []
    for i in range(2):
        score += [0]
        count += [[0] * (10 + 1)]
        for ss in input().split():
            s = int(ss)
            score[i] += s
            count[i][s] += 1
    result = "remis"
    if score[0] > score[1]:
        result = "Algosia"
    elif score[0] < score[1]:
        result = "Bajtek"
    else:
        for i in range(10, -1, -1):
            if count[0][i] > count[1][i]:
                result = "Algosia"
                break
            elif count[0][i] < count[1][i]:
                result = "Bajtek"
                break
    print(result)


if __name__ == "__main__":
    if len(sys.argv) == 2:
        sys.stdin = open(sys.argv[1])
    main()