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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <bits/stdc++.h>

using namespace std;

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;

#define rep(i, j) for (int i = 0; i < (int)(j); i++)
#define pb push_back
#define st first
#define nd second

void TEST([[maybe_unused]] int testcase_i) {
  vector<int> a(18), b(18);
  rep(i, 18) cin >> a[i];
  rep(i, 18) cin >> b[i];

  int sum_a = accumulate(a.begin(), a.end(), 0);
  int sum_b = accumulate(b.begin(), b.end(), 0);

  map<int, int> cnt_a, cnt_b;
  for (int el : a) {
    cnt_a[el]++;
  }
  for (int el : b) {
    cnt_b[el]++;
  }

  if (sum_a > sum_b) {
    cout << "Algosia";
    return;
  }

  if (sum_a < sum_b) {
    cout << "Bajtek";
    return;
  }

  for (int i = 10; i >= 0; i--) {
    if (cnt_a[i] > cnt_b[i]) {
      cout << "Algosia";
      return;
    }
    if (cnt_a[i] < cnt_b[i]) {
      cout << "Bajtek";
      return;
    }
  }

  cout << "remis";
}

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

  cout << setprecision(20) << fixed;

  // srand(time(NULL));

  // freopen("sorting.in", "r", stdin);
  // freopen("sorting.out", "w", stdout);

  int t = 1;
  // cin >> t;
  rep(i, t) {
    TEST(i);
  }

  return 0;
}