1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
def determine_winner(algosia_scores, bajtek_scores):
    algosia_sum = sum(algosia_scores)
    bajtek_sum = sum(bajtek_scores)

    if algosia_sum != bajtek_sum:
        return "Algosia" if algosia_sum > bajtek_sum else "Bajtek"

    for points in range(10, 0, -1):
        algosia_points_count = algosia_scores.count(points)
        bajtek_points_count = bajtek_scores.count(points)
        if algosia_points_count != bajtek_points_count:
            return "Algosia" if algosia_points_count > bajtek_points_count else "Bajtek"

    return "remis"

algosia_scores = list(map(int, input().split()))
bajtek_scores = list(map(int, input().split()))

print(determine_winner(algosia_scores, bajtek_scores))