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
//GRT_2018
#include <bits/stdc++.h>
#define PB push_back
#define ST first
#define ND second
#define all(x) x.begin(), x.end()
//mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

using namespace std;

using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;

int n = 18;
int cnt[20];

void A() {
    cout << "Algosia";
}

void B() {
    cout << "Bajtek";
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
    int s = 0;
    for (int x, i = 0; i < n; ++i) {
        cin >> x;
        s += x;
        cnt[x]++;
    }
    for (int x, i = 0; i < n; ++i) {
        cin >> x;
        s -= x;
        cnt[x]--;
    }
    if (s > 0) {
        A();
    } else if (s < 0) {
        B();
    } else {
        for (int i = 10; i >= 0; --i) {
            if (cnt[i] > 0) {
                A();
                return 0;
            } else if (cnt[i] < 0) {
                B();
                return 0;
            }
        }
        cout << "remis";
    }

}