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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
 * Author: toko
 * Time: 2024-03-12 15:05:03
 */

#define NDEBUG
#ifdef NDEBUG
#pragma GCC optimize("Ofast,unroll-loops")
#else
#pragma GCC optimize("Og")
#endif

#include <iostream>
using namespace std;

int main()
{
	iostream::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int a[18], b[18];
	for (int i = 0; i < 18; i++)
		cin >> a[i];
	for (int i = 0; i < 18; i++)
		cin >> b[i];

	int sumaA = 0, sumaB = 0;
	int numberA[11] = { 0 }, numberB[11] = { 0 };
	for (int i = 0; i < 18; i++)
	{
		sumaA += a[i];
		sumaB += b[i];
		numberA[a[i]]++;
		numberB[b[i]]++;
	}

	if (sumaA > sumaB)
	{
		cout << "Algosia\n";
	}
	else if (sumaA < sumaB)
	{
		cout << "Bajtek\n";
	}
	else
	{
		for (int i = 10; i >= 0; i--)
		{
			if (numberA[i] > numberB[i])
			{
				cout << "Algosia\n";
				return 0;
			}
			else if (numberA[i] < numberB[i])
			{
				cout << "Bajtek\n";
				return 0;
			}
		}
		cout << "remis\n";
	}


	return 0;
}