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
#include <bits/stdc++.h>

#define DEBUG(x) cout << #x << ": " << x << '\n';

using namespace std;
using ll = long long;

int main() {
    vector<int> a(12);
    vector<int> b(12);
    for (int i = 0; i < 18; ++i) {
        int x;
        cin >> x;
        a[11] += x;
        a[x]++;
    }
    for (int i = 0; i < 18; ++i) {
        int x;
        cin >> x;
        b[11] += x;
        b[x]++;
    }
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    if (a > b) {
        cout << "Algosia";
    } else if (a < b) {
        cout << "Bajtek";
    } else {
        cout << "remis";
    }
}