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;
#ifdef DEBUG
auto&operator<<(auto &o, pair<auto, auto> p) {o << "(" << p.first << ", " << p.second << ")"; return o;}
auto operator<<(auto &o, auto x)->decltype(x.end(), o) {o<<"{"; for(auto e : x) o<<e<<", "; return o<<"}";}
#define debug(X) cerr << "["#X"]: " << X << '\n';
#else 
#define cerr if(0)cout
#define debug(X) ;
#endif
using ll = long long;
#define all(v) (v).begin(), (v).end()
#define ssize(x) int(x.size())
#define fi first
#define se second
#define mp make_pair
#define eb emplace_back

int a[11], b[11];
int main() {
	ios_base::sync_with_stdio(false); cin.tie(nullptr);

	int s1 = 0, s2 = 0;
	for(int i = 0; i < 18; ++i) {int x; cin >> x; s1 += x; a[x]++;}
	for(int i = 0; i < 18; ++i) {int x; cin >> x; s2 += x; b[x]++;}

	if(s1 == s2) {
		int j = 10;
		while(j >= 0 && a[j] == b[j]) j--;
		if(j < 0) cout << "remis";
		else cout << (a[j] > b[j] ? "Algosia" : "Bajtek");
	}
	else cout << (s1 > s2 ? "Algosia" : "Bajtek");

	return 0;
}