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/python3


seq_A = [int(a) for a in input().split()]
seq_B = [int(a) for a in input().split()]
assert(len(seq_A) == 18)
assert(len(seq_B) == 18)


def solve():
    output_A = "Algosia"
    output_B = "Bajtek"

    if sum(seq_B) < sum(seq_A):
        return output_A
    elif sum(seq_A) < sum(seq_B):
        return output_B

    kub_A = 11 * [0]
    for score in seq_A:
        kub_A[score] += 1
    kub_B = 11 * [0]
    for score in seq_B:
        kub_B[score] += 1

    for i in range(10, 0, -1):
        if kub_B[i] < kub_A[i]:
            return output_A
        elif kub_A[i] < kub_B[i]:
            return output_B

    return "remis"


print(solve())