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
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using str = string;
#define all(a) a.begin(), a.end()
#define print(a) for (auto elem:a) cout<<elem<<' '; cout<<'\n'
#define segprep(b) resize(1<<((int)ceil(log2(b.size()))+1))

int sum(vi::iterator f, vi::iterator l){
    int ans = 0;
    for (auto p = f; p != l; p++){
        ans += *p;
    }
    return ans;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    vi alg(18);
    vi bajt(18);
    for (auto &i:alg) cin>>i;
    for (auto &i:bajt) cin>>i;
    if (sum(all(alg)) > sum(all(bajt))){
        cout<<"Algosia\n";
        return 0;
    }
    if (sum(all(alg)) < sum(all(bajt))){
        cout<<"Bajtek\n";
        return 0;
    }
    sort(all(alg), greater<int>());
    sort(all(bajt), greater<int>());

    if (alg == bajt){
        cout<<"remis\n";
    }
    else if (alg > bajt){
        cout<<"Algosia\n";
    }
    else{
        cout<<"Bajtek\n";
    }
}