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
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;

#define pb push_back

typedef long long ll;
typedef long double ld;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    vector<int> a(18), b(18);
    vector<int> cnt_a(11), cnt_b(11);
    for (int i = 0; i < 18; i++) {
        cin >> a[i];
        cnt_a[a[i]]++;
    }
    for (int i = 0; i < 18; i++) {
        cin >> b[i];
        cnt_b[b[i]]++;
    }
    reverse(cnt_a.begin(), cnt_a.end());
    reverse(cnt_b.begin(), cnt_b.end());
    int sa = accumulate(a.begin(), a.end(), 0);
    int sb = accumulate(b.begin(), b.end(), 0);
    cnt_a.insert(cnt_a.begin(), sa);
    cnt_b.insert(cnt_b.begin(), sb);
    if (cnt_a > cnt_b) {
        cout << "Algosia\n";
    }
    else if (cnt_a < cnt_b) {
        cout << "Bajtek\n";
    }
    else {
        cout << "remis\n";
    }
    return 0;
}