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
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
int main() {
  ios_base::sync_with_stdio(0); cin.tie(0);
  vector<int>A(19), B(19);
  rep(i, 18) {
    cin >> A[i];
    A[18]+=A[i];
  }
  rep(i, 18) {
    cin >> B[i];
    B[18]+=B[i];
  }
  sort(all(A));
  sort(all(B));
  reverse(all(A));
  reverse(all(B));
  rep(i, 19) {
    if(A[i]>B[i]) {
      cout << "Algosia\n";
      return 0;
    }
    if(B[i]>A[i]) {
      cout << "Bajtek\n";
      return 0;
    }
  }
  cout << "remis\n";
}