1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from collections import Counter

def main():
    a = [int(e) for e in input().split()]
    b = [int(e) for e in input().split()]
    if sum(a) > sum(b):
        print("Algosia")
        return
    elif sum(a) < sum(b):
        print("Bajtek")
        return
    a = Counter(a)
    b = Counter(b)
    for i in range(10, -1, -1):
        if a[i] > b[i]:
            print("Algosia")
            return
        elif a[i] < b[i]:
            print("Bajtek")
            return
    print("remis")

main()