1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
using namespace std;
int sum[2], c[2][11];
int main(){
	for (int j = 0; j < 2; j++) {
		for (int i = 0; i < 18; i++) {
			int a;
			cin >> a;
			sum[j] += a;
			c[j][a]++;
		}
	}
	int who = sum[1] - sum[0];
	for (int i = 10; i >= 0 && who == 0; i--)
		who = c[1][i] - c[0][i];
	if (who > 0)
		cout << "Bajtek";
	else if (who < 0)
		cout << "Algosia";
	else
		cout << "remis";
}