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
44
45
46
47
#!/usr/bin/python3.9

import functools
import sys

def exit(x):
        if x == 0:
                print("Algosia")
        else:
                print("Bajtek")
        sys.exit(0)

def calc_num_of_n(l, n):
        return functools.reduce(lambda x,y: x+y, map(lambda x: 1 if x == n else 0, l), 0)

a = list(map(lambda x: int(x), input().split()))
b = list(map(lambda x: int(x), input().split()))

suma=functools.reduce(lambda x,y:x+y,a)
sumb=functools.reduce(lambda x,y:x+y,b)

if (suma > sumb):
        exit(0)
if (suma < sumb):
        exit(1)

for i in range(10, 0, -1):
        numa=calc_num_of_n(a, i)
        numb=calc_num_of_n(b, i)
        if numa > numb:
                exit(0)
        if numa < numb:
                exit(1)

print("remis")



#print(b)


#n = int(input())
#s = input()
#testlen = n//10

#l = [ s[i:i+testlen] for i in range(0, n, testlen) ]
#print(functools.reduce(lambda x,y:x+y, map(calc_test, l)))