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
#include <iostream>
#include <array>
#include <algorithm>

int main() {
	std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
	
	int asum = 0;
	int bsum = 0;
	std::array<int, 11> A{}, B{};
	for (int i = 0; i < 18; ++i) {
		int x;
		std::cin >> x;
		A[x]++;
		asum += x;
	}
	for (int i = 0; i < 18; ++i) {
		int x;
		std::cin >> x;
		B[x]++;
		bsum += x;
	}
	
	int result = bsum - asum;
	
	for (int i = 10; !result && i >= 0; --i) {
		result = B[i] - A[i];
	}
	
	if (result < 0) {
		std::cout << "Algosia\n";
	} else if (result > 0) {
		std::cout << "Bajtek\n";
	} else {
		std::cout << "remis\n";
	}
}