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
32
33
34
35
36
37
38
39
40
41
42
43
import sys

sum_a = 0
sum_b = 0
a_c = [0 for i in range(11)]
b_c = [0 for i in range(11)]

str_a = input().split(" ")
str_b = input().split(" ")

for e in str_a:
    r = int(e)
    #print(r)
    a_c[r] += 1
    sum_a += r

for e in str_b:
    r = int(e)
    #print(r)
    b_c[r] += 1
    sum_b += r


#print(sum_a, a_c)
#print(sum_b, b_c)

if sum_a > sum_b:
    print("Algosia")
    sys.exit(0)

if sum_a < sum_b:
    print("Bajtek")
    sys.exit(0)

for i in range(10, 0, -1):
    if a_c[i] > b_c[i]:
        print("Algosia")
        sys.exit(0)
    if a_c[i] < b_c[i]:
        print("Bajtek")
        sys.exit(0)

print("remis")