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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include<bits/stdc++.h>

#define FOR(i,s,e) for(int i=(s); i<=(e); i++)
#define FORD(i,s,e) for(int i=(s); i>=(e); i--)
#define ALL(k) (k).begin(), (k).end()
#define e1 first
#define e2 second
#define mp make_pair
 
using namespace std;
using LL=long long;
using LD=long double;
using PII=pair<int,int>;

const int MAXN=1111;

const auto A_WINNER = "Algosia";
const auto B_WINNER = "Bajtek";
const auto DRAW = "remis";

int count_points_a[11];
int count_points_b[11];


int main(){
    int sum_a = 0;
    FOR(i,1,18){
        int points_a; scanf("%d", &points_a);
        count_points_a[points_a]++;
        sum_a += points_a;
    }
    int sum_b = 0;
    FOR(i,1,18){
        int points_b; scanf("%d", &points_b);
        count_points_b[points_b]++;
        sum_b += points_b;
    }
    if (sum_a > sum_b){
        puts(A_WINNER);
    }
    else if (sum_a < sum_b){
        puts(B_WINNER);
    }
    else{
        bool game_decided = false;
        FORD(i,10,0) {
            if (count_points_a[i] > count_points_b[i]){
                puts(A_WINNER);
                game_decided = true;
                break;
            }
            else if (count_points_a[i] < count_points_b[i]) {
                puts(B_WINNER);
                game_decided = true;
                break;
            }
        }
        if (!game_decided){
            puts(DRAW);
        }
    }
}