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
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 2137
#endif

int n = 18;
int cnt[2][11], sum[2];

void ret(int x) {
  cout << (x == 1 ? "Algosia" : (x == -1 ? "Bajtek" : "remis")) << '\n';
  exit(0);
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < n; j++) {
      int x;
      cin >> x;
      cnt[i][x]++;
      sum[i] += x;
    }
  }
  if (sum[0] != sum[1]) {
    ret(sum[0] > sum[1] ? 1 : -1);
  }
  for (int i = 10; i >= 0; i--) {
    if (cnt[0][i] != cnt[1][i]) {
      ret(cnt[0][i] > cnt[1][i] ? 1 : -1);
    }
  }
  ret(0);
}