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
# include <bits/stdc++.h>
# define For(i, l, r) for(int i = (l); i <= (r); i++)
# define Rep(i, n) For(i, 0, (n) - 1)
# define size(x) (ll)x.size()
# define MAXSZ 500005
# define all(x) x.begin(),x.end()
using namespace std;
typedef int ll;
typedef long double ld;
const ll inf = 1e9 + 7;
const ll mod = 1e9 + 7;
ll n , m , q , r , k , t , L , R;
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    vector<ll>v1(18) , v2(18);
    ll sum1 = 0;
    Rep (i , 18) cin >> v1[i] , sum1 += v1[i];
    ll sum2 = 0;
    Rep (i , 18) cin >> v2[i] , sum2 += v2[i];
    // cout << sum1 << ' ' << sum2 << "\n";
    if (sum1 > sum2) cout << "Algosia";
    else if (sum2 > sum1) cout << "Bajtek";
    else {
        sort(v1.rbegin() , v1.rend());
        sort(v2.rbegin() , v2.rend());
        if (v1 == v2) {
            cout << "remis";
            return 0;
        }
        Rep (i , 18) {
             if (v1[i] == v2[i])continue;
             if (v1[i] > v2[i]) {
                cout << "Algosia";
                return 0;
             } else {
                cout << "Bajtek";
                return 0;
             }
        }
    }
}
//odjgoadfhfoav hash1 i hash2 (hash1 * 1e9 + hash