1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
def main():
    Algosia_results = sorted([int(x) for x in input().split()])[::-1]
    Bajtek_results = sorted([int(x) for x in input().split()])[::-1]

    Algosia_results_sum = sum(Algosia_results)
    Bajtek_results_sum = sum(Bajtek_results)

    if Algosia_results_sum > Bajtek_results_sum:
        return "Algosia"
    elif Algosia_results_sum < Bajtek_results_sum:
        return "Bajtek"
    else:
        for i in range(len(Algosia_results)):
            if Algosia_results[i] > Bajtek_results[i]:
                return "Algosia"
            elif Algosia_results[i] < Bajtek_results[i]:
                return "Bajetek"
        return "remis"


if __name__ == '__main__':
    main()