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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include <bits/stdc++.h>
#pragma GCC optimize("O2")
//#pragma GCC optimize ("trapv")

using namespace std;

#ifdef local
    #include "debug.h"
    #define pr(...) debug(#__VA_ARGS__, __VA_ARGS__)
    #define prs(...) debug_nameless(__VA_ARGS__)
#else
    #define pr(...) 69
    #define prs(...) 69
#endif

#define pb push_back
#define endl '\n'

typedef double dbl;
typedef long long ll;
typedef unsigned long long ull;

const int inf = 1e9;
const ll binf = 1e18;
const dbl eps = 1e-9;

void setIO(string s = "") {
    ios_base::sync_with_stdio(0); cin.tie(0);
    if(s.size() > 0){
        freopen((s + ".in").c_str(), "r", stdin);
        freopen((s + ".out").c_str(), "w", stdout);
    }
}

void solve(int tc){
    int n = 18;
    vector <int> a(11);
    int sum_a = 0;
    for(int i = 0; i < n; i++){
        int tmp;
        cin >> tmp;

        a[tmp] += 1;
        sum_a += tmp;
    }

    vector <int> b(11);
    int sum_b = 0;
    for(int i = 0; i < n; i++){
        int tmp;
        cin >> tmp;

        b[tmp] += 1;
        sum_b += tmp;
    }

    if(sum_a > sum_b){
        cout << "Algosia" << endl;
        return;
    }

    if(sum_b > sum_a){
        cout << "Bajtek" << endl;
        return;
    }

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

    cout << "remis" << endl;
}   

int main(){
    setIO();

    int tc = -1;
    tc = 1;
    if(tc != 1) cin >> tc;
    
    for (int t = 0; t < tc; t++) {
        pr(t); prs(string(50, '-'));
        solve(t);
        prs(string(50, '-') + "\n");
    }

    return 0;
}