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
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
#include <cassert>
#include <iostream>
#include <istream>
#include <fstream>
#include <algorithm>
#include <cstdio>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <string>
#include <cstdlib>
#include <memory>
#include <ctime>
#include <bitset>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <ranges>

using namespace std;

class Kto2024
{
	long n;
	vector<int> input1;
	vector<int> input2;

	vector<int> tab1;
	vector<int> tab2;


public:

	void virtual Solve()
	{
		input1 = vector<int>(18, 0);
		input2 = vector<int>(18, 0);

		tab1 = vector<int>(11, 0);
		tab2 = vector<int>(11, 0);

		int sum1 = 0;
		int sum2 = 0;

		//READ:
		for (int i = 0; i < 18; i++) {
			cin >> input1[i];
		}

		for (int i = 0; i < 18; i++) {
			cin >> input2[i];
		}

		//PREP:
		for (int i = 0; i < 18; i++) {
			sum1 += input1[i];
			sum2 += input2[i];

			tab1[input1[i]]++;
			tab2[input2[i]]++;
		}

		//CALC:
		int res = 0;
		if (sum1 == sum2) {
			for (int i = 10; i >= 1; i--) {
				if (tab1[i] > tab2[i]) {
					res = -1;
					break;
				}
				else if (tab1[i] < tab2[i]) {
					res = 1;
					break;
					
				}
			}
		}
		else {
			if (sum1 > sum2) {
				res = -1;
			}
			else if (sum2 > sum1) {
				res = 1;
			}
		}

		//PRINT:
		if (res == -1) {
			std::cout << "Algosia" << std::endl;
		}
		else if (res == 1) {
			std::cout << "Bajtek" << std::endl;
		}
		else {
			std::cout << "remis" << std::endl;
		}

	}
};

int main()
{
	Kto2024* p = new Kto2024();
	p->Solve();
	delete p;
	return 0;
}