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
from collections import Counter

A = list(map(int, input().split()))
B = list(map(int, input().split()))

a_name = "Algosia"
b_name = "Bajtek"
draw_name = "remis"


def decide(A, B):
    if sum(A) > sum(B):
        return a_name
    if sum(B) > sum(A):
        return b_name
    A, B = Counter(A), Counter(B)

    for i in range(10, -1, -1):
        if A[i] > B[i]:
            return a_name
        if B[i] > A[i]:
            return b_name
    return draw_name


print(decide(A, B))