1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
def solution(a, b):
    suma = sum(a)
    sumb = sum(b)
    if suma>sumb:
        return "Algosia"
    elif suma<sumb:
        return "Bajtek"
    else:
        # from 10 to 0 inclusive
        for i in range(10, -1, -1):
            if a.count(i)>b.count(i):
                return "Algosia"
            elif a.count(i)<b.count(i):
                return "Bajtek"
        return "remis"

if __name__ == "__main__":
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    print(solution(a, b))