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
//Jakub Nowak XIV LO Wroclaw
#include<bits/stdc++.h>
using namespace std;

#define boost ios_base::sync_with_stdio(false); cin.tie(0);
#define int long long
#define vi vector<int>
#define pb push_back
#define st first
#define nd second

void solve() {
    int sa = 0, sb = 0;
    vi A(11, 0);
    vi B(11, 0);

    for(int i=1; i<=18; i++) {
        int a;
        cin >> a;
        A[a]++;
        sa+=a;
    }
    for(int i=1; i<=18; i++) {
        int b;
        cin >> b;
        B[b]++;
        sb+=b;
    }

    if(sa > sb) {
        cout << "Algosia" << "\n";
        return;
    }
    if(sb > sa) {
        cout << "Bajtek" << "\n";
        return;
    }

    for(int i=10; i>=0; i--) {
        if(A[i] > B[i]) {
            cout << "Algosia" << "\n";
            return;
        }
        if(B[i] > A[i]) {
            cout << "Bajtek" << "\n";
            return;
        }
    }
    cout << "remis" << "\n";

    //cout << sa << " " << sb << "\n";
}

int32_t main() {
    boost
    solve();
}