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
if __name__ == "__main__":
    f_scores = [int(i) for i in input().split(' ')]
    s_scores = [int(i) for i in input().split(' ')]

    f_sum = sum(f_scores)
    s_sum = sum(s_scores)

    if f_sum == s_sum:
        for i in range(10, 0, -1):
            f_total = f_scores.count(i)
            s_total = s_scores.count(i)
            if (f_total == s_total):
                continue
            if (f_total > s_total):
                print("Algosia")
                break
            else:
                print("Bajtek")
                break;
        else:
            print("remis")
    elif f_sum > s_sum:
        print("Algosia")
    else:
        print("Bajtek")