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
algosia = 'Algosia'
bajtek = 'Bajtek'
remis = 'remis'

algosia_input = input()
bajtek_input = input()

algosia_integers = [int(a) for a in algosia_input.split()]
bajtek_integers = [int(b) for b in bajtek_input.split()]

if sum(algosia_integers) > sum(bajtek_integers):
    print(algosia)
elif sum(algosia_integers) < sum(bajtek_integers):
    print(bajtek)
else:
    algosia_scores = [0]*11
    bajtek_scores = [0]*11 
    for x in range(18):
        algosia_scores[algosia_integers[x]] += 1
        bajtek_scores[bajtek_integers[x]] += 1
        
    for i in range(10):
        if algosia_scores[10-i] > bajtek_scores[10-i]:
            print(algosia)
            exit()
        elif algosia_scores[10-i] < bajtek_scores[10-i]:
            print(bajtek)   
            exit()
    print(remis)