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
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i= 0; i<(n); i++)
#define reps(i,s, n) for(int i= (s); i<(n); i++)
#define each(a, x) for (auto &a : x)
#define vv(T) vector<T>
#define endl '\n'
#define sz(x) (int)x.size()
#define ll long long
#define all(c) begin(c), end(c)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
#define wr cout<<
#define wre wr endl ;
#define wrut(a) {wre each(i,(a))wr i<<" "; wre}
#define wrot(a,b,c,d) {wre wr a<<" "<<b<<" "<<c<<" "<<d; wre}
#define int ll


void solve(){
    vv(int )s(2,0); 
    int h[2][11];
    memset(h, 0,sizeof(h));
    int x;
    rep(i,2){
        rep(j,18){
            cin>>x;
            s[i]+=x;
            h[i][x]++;
        }
    }
    bool xd=1;
    if (s[0]==s[1]){
        for (int j=10; j>0; j--){
            if (h[0][j]==h[1][j]){
                continue;
            }
            if (h[0][j]>h[1][j]){
                {wr "Algosia";xd=0;break;}
            }else {wr "Bajtek";xd=0;break;}
        }
        if (xd)wr "remis";
    }else{
        if (s[0]>s[1]){
            wr "Algosia";
        }
        else wr "Bajtek";
    }

}


signed main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int t=1;
 // cin>>t;
while(t--)solve();
}