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

using namespace std;

#define FOR(i,a,b) for(int i=a; i<=b; i++)
#define FORR(i,a,b) for(int i=a; i>=b; i--)
#define For(n) for(int i=0;i<n;i++)
#define ll long long
#define ull unsigned long long
#define pb push_back
#define pf push_front
#define mp make_pair
#define vi vector<int>
#define vb vector<bool>
#define vll vector<ll>
#define vvi vector<vector<int>>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define ps push
#define setbits(x) __builtin_popcountll(x)

const int MAX = 1e6+5;
const int INF = 1e9+5;
const int MOD1 = 1e9+7;
const int MOD2 = 1e9+9;

void solve()
{
    int Algosia[18], Bajtek[18];
    int sum_A=0, sum_B=0;

    FOR(i,0,17) {cin>>Algosia[i]; sum_A+=Algosia[i];}
    FOR(i,0,17) {cin>>Bajtek[i]; sum_B+=Bajtek[i];}

    if(sum_A>sum_B) {cout<<"Algosia"; return;}
    if(sum_A<sum_B) {cout<<"Bajtek"; return;}

    sort(Algosia, Algosia+18, greater<int>());
    sort(Bajtek, Bajtek+18, greater<int>());

    FOR(i,0,17)
    {
        if(Algosia[i]>Bajtek[i]) {cout<<"Algosia"; return;}
        if(Algosia[i]<Bajtek[i]) {cout<<"Bajtek"; return;}
    }
    cout<<"remis";
}


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

    solve();

    return 0;
}