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

int sum(const vector<int> &vec) {
	int result = 0;
	for (const auto x : vec) {
		result += x;
	}
	return result;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	
	const int n = 18;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	
	if (sum(a) > sum(b)) {
		cout << "Algosia\n";
	}
	else if (sum(a) < sum(b)) {
		cout << "Bajtek\n";
	}
	else {
		sort(a.begin(), a.end(), greater<int>());
		sort(b.begin(), b.end(), greater<int>());
		if (a > b) {
			cout << "Algosia\n";
		}
		else if (a < b) {
			cout << "Bajtek\n";
		}
		else {
			cout << "remis\n";
		}
	}
	
	return 0;
}