1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import sys
from collections import Counter

data = sys.stdin.readlines()
algosia, bajtek = data

algosia = list(map(int, algosia.strip().split()))
bajtek = list(map(int, bajtek.strip().split()))

if sum(algosia) > sum(bajtek):
    print("Algosia")
elif sum(algosia) < sum(bajtek):
    print("Bajtek")
else:
    algosia = Counter(algosia)
    bajtek = Counter(bajtek)
    for i in range(10):
        if algosia[i] > bajtek[i]:
            print("Algosia")
            exit()
        elif algosia[i] < bajtek[i]:
            print("Bajtek")
            exit()
    print("remis")