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

using namespace std;

int main() {
	ios::sync_with_stdio(false), cin.tie(nullptr);

	vector<int> a(18), b(18);
	int A = 0, B = 0;

	for (int &x : a) {
		cin >> x;
		A += x;
	}
	
	for (int &x : b) {
		cin >> x;
		B += x;
	}

	sort(a.rbegin(), a.rend());
	sort(b.rbegin(), b.rend());

	if (make_pair(A, a) > make_pair(B, b))
		cout << "Algosia\n";
	else
	if (make_pair(A, a) < make_pair(B, b))
		cout << "Bajtek\n";
	else
		cout << "remis\n";

	return 0;
}