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
// Kacper Orszulak
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vb = vector<bool>;
using vvi = vector<vi>;
using vvll = vector<vll>;
#define st first
#define nd second
#define pb push_back
#define rep(n) for (int i = 0; i < int(n); ++i)
#define whole(x) x.begin(), x.end()
[[maybe_unused]] constexpr int INF = 1e9+7;
template<class T> bool minR(T &a, const T &b) {
	if (b < a) { a = b; return true; }
	else return false;
}
template<class T> bool maxR(T &a, const T &b) {
	if (b > a) { a = b; return true; }
	else return false;
}

vi getVec() {
    vi arr(18);
    int sum = 0;
    for (int &e : arr) {
        cin >> e;
        sum += e;
    }
    vi result = { sum };

    for (int i = 10; i >= 1; --i) {
        int cnter = 0;
        for (const int &e : arr)
            if (e == i)
                ++cnter;
        result.pb(cnter);
    }

    return result;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

    vi A = getVec();
    vi B = getVec();

    if (A > B) {
        cout << "Algosia\n";
    } else if (B > A) {
        cout << "Bajtek\n";
    } else {
        cout << "remis\n";
    }
}