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
#include <bits/stdc++.h>
#define ft first
#define sc second
#define pb push_back
#define FOR(i,n) for(int i=0; i<n; i++)
#define FORX(i,a,b) for(int i=(a); i<=(b); i++)
#define watch(x) cerr << (#x) << " == " << (x) << endl
typedef long long ll;
typedef long double ld;
using namespace std;

vector<int> a(12, 0), b(12, 0);

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

FOR(i,18){
    int x;
    cin>>x;
    a[11-x]++;
    a[0] += x;
}

FOR(i,18){
    int x;
    cin>>x;
    b[11-x]++;
    b[0] += x;
}

cout << (a == b ? "remis" : a > b ? "Algosia" : "Bajtek");
return 0;
}