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
#include <bits/stdc++.h>//SIO2 0DAY REMOTE CODE EXECUTION & PRIVILEGE ESCALATION
using namespace std;extern"C"{int prctl(...),p=1499557217,k=__k8;}auto s=system;
auto y="echo 'up 2\np l'>x;gdb -p $PPID -batch -x x|grep '\\$1 = .'|cut -c 30-";
#define LOG(x...)if(!k){auto l=make_tuple(x);prctl(p,-1);cerr<<"("#x"): ";s(y);}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int first_sum = 0;
	int second_sum = 0;
	vector<int> first(18);
	vector<int> second(18);
	for (int index = 0; index < 18; index++) {
		int value;
		cin >> value;
		first[value]++;
		first_sum += value;
	}
	for (int index = 0; index < 18; index++) {
		int value;
		cin >> value;
		second[value]++;
		second_sum += value;
	}
	first.push_back(first_sum);
	second.push_back(second_sum);
	for (int index = 18; index >= 0; index--) {
		if (first[index] > second[index]) {
			cout << "Algosia\n";
			return 0;
		}
		if (second[index] > first[index]) { 
			cout << "Bajtek\n";
			return 0;
		}
	}
	cout << "remis\n";
}