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

#define ll long long
#define fors(u, n, s) for(ll u = (s); u < (n); u++)
#define foru(u, n) fors(u, n, 0)
#define vec vector
#define pb push_back
#define f first
#define s second
#define ir(a, b, x) (((a) <= (x)) && ((x) <= (b)))

using namespace std;

int a[11];
int b[11];

int a_s = 0;
int b_s = 0;

int main() {

    foru(_i, 18) {
        int inp; cin >> inp;
        a[inp] ++; a_s += inp;
    }

    foru(_i, 18) {
        int inp; cin >> inp;
        b[inp] ++; b_s += inp;
    }

    if (a_s > b_s) {
        cout << "Algosia"; return 0;
    }

    if (b_s > a_s) {
        cout << "Bajtek"; return 0;
    }

    for (int i = 10; i >= 0; i--) {
        if (a[i] > b[i]) {
            cout << "Algosia"; return 0;
        }

        if (b[i] > a[i]) {
            cout << "Bajtek"; return 0;
        }
    }

    cout << "remis";
    return 0;
}