1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <bits/stdc++.h>

using namespace std;

int main(){
	
	vector<int> a(18), b(18); int A = 0, B = 0;
	for(int i = 0; i < 18; ++i){cin >> a[i]; A += a[i];}
	for(int i = 0; i < 18; ++i){cin >> b[i]; B += b[i];}
	
	if(A > B) cout << "Algosia\n";
	else if(B > A) cout << "Bajtek\n";
	else{
		sort(a.begin(), a.end()); sort(b.begin(), b.end());
		int i = 17;
		while(i >= 0){
			if(a[i] > b[i]){cout << "Algosia\n"; return 0;}
			else if(b[i] > a[i]){cout << "Bajtek\n"; return 0;}
			--i;
		}
		cout << "remis\n";
	}
	return 0;
}