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
import sys

aa = [int(i) for i in input().split(' ')]
bb = [int(i) for i in input().split(' ')]

asum = sum(aa)
bsum = sum(bb)

if asum > bsum:
    print('Algosia')
    sys.exit()
elif asum < bsum:
    print('Bajtek')
    sys.exit()

a = [0 for _ in range(11)]
b = [0 for _ in range(11)]

for i in range(18):
    a[aa[i]] += 1
    b[bb[i]] += 1

aw = False
bw = False
for i in range(10, -1, -1):
    if a[i] > b[i]:
        aw = True
        break
    if a[i] < b[i]:
        bw = True
        break

if aw:
    print('Algosia')
elif bw:
    print('Bajtek')
else:
    print('remis')