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
def main():
    alg_points = [int(i) for i in input().split()]
    baj_points = [int(i) for i in input().split()]

    if sum(alg_points) > sum(baj_points):
        return "Algosia"

    if sum(alg_points) < sum(baj_points):
        return "Bajtek"

    alg_counter = {i: 0 for i in range(11)}
    for p in alg_points:
        alg_counter[p] += 1

    baj_counter = {i: 0 for i in range(11)}
    for p in baj_points:
        baj_counter[p] += 1

    for i in range(10, -1, -1):
        if alg_counter[i] > baj_counter[i]:
            return "Algosia"

        if alg_counter[i] < baj_counter[i]:
            return "Bajtek"

    return "remis"


if __name__ == "__main__":
    result = main()
    print(result)