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

#define int int64_t
#define pb push_back
#define pii pair<int, int>
#define st first
#define nd second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	vector<int> a(12, 0), b(12, 0);
	for(int i=0;i<18;i++) {
		int x;
		cin >> x;
		a[x]++;
		a[11] += x;
	}
	for(int i=0;i<18;i++) {
		int x;
		cin >> x;
		b[x]++;
		b[11] += x;
	}
	reverse(all(a));
	reverse(all(b));
	if(a>b) {
		cout << "Algosia\n";
	} else if(a<b) {
		cout << "Bajtek\n";
	} else {
		cout << "remis\n";
	}
}