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
#pragma GCC optimize("O3,unroll-loops") 
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
 
//a poem about frogs
 
#include <bits/stdc++.h>
 
#define st first
#define nd second
#define eb emplace_back
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define mp make_pair
#define ii pair<int, int>
#define all(a) a.begin(), a.end()
#define fastio() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(a, b) for (int a = 0; a < b; ++a)
 
using namespace std;

int main() {
	fastio();
	vi a(18), b(18);
	int sma=0, smb=0;
	rep(i, 18) {
		cin >> a[i];
		sma += a[i];
	}
	rep(i, 18) {
		cin >> b[i];
		smb += b[i];
	}
	if (sma > smb) {cout << "Algosia\n";return 0;}
	if (sma < smb) {cout << "Bajtek\n"; return 0;}
	sort(all(a));
	reverse(all(a));
	sort(all(b));
	reverse(all(b));
	if (a < b) cout << "Bajtek\n";
	else if (a > b) cout << "Algosia\n";
	else cout << "remis\n";


	return 0;
}