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

using namespace std;

#define ff first
#define ss second
#define mp make_pair
#define pb push_back
using ll=long long;
using cll=const ll;
using pll=pair<ll,ll>;
using pii=pair<int,int>;



int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); //cout.tie(NULL);

    vector<int> v1;
    vector<int> v2;
    int s1=0,s2=0;

    for(int i=0;i<18;i++){
        int x;
        cin>>x;
        v1.pb(x);
        s1+=x;
    }

    for(int i=0;i<18;i++){
        int x;
        cin>>x;
        v2.pb(x);
        s2+=x;
    }

    if(s1 > s2){
        cout << "Algosia\n";
        return 0;
    }
    else if(s1 < s2){
        cout << "Bajtek\n";
        return 0;
    }

    sort(v1.begin(),v1.end());
    reverse(v1.begin(),v1.end());

    sort(v2.begin(),v2.end());
    reverse(v2.begin(),v2.end());

    for(int i=0;i<18;i++){
        if(v1[i] > v2[i]){
            cout << "Algosia\n";
            return 0;
        }
        else if(v1[i] < v2[i]){
            cout << "Bajtek\n";
            return 0;
        }
    }

    cout << "remis\n";
    


    return 0;
}