1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
a = [int(x) for x in input().split(" ")]
b = [int(x) for x in input().split(" ")]

def solve(a, b):
    if sum(a) > sum(b):
        return "Algosia"
    elif sum(a) < sum(b):
        return "Bajtek"
    else:
        a_results = {i: len([x for x in a if x == i]) for i in range(1, 11)}
        b_results = {i: len([x for x in b if x == i]) for i in range(1, 11)}
        for i in reversed(range(1, 11)):
            if a_results[i] > b_results[i]:
                return "Algosia"
            elif a_results[i] < b_results[i]:
                return "Bajtek"
        return "remis"

result = solve(a, b)
print(result)