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
#include <algorithm>
#include <iostream>
#include <vector>
#define nl '\n'

using namespace std;

vector<int> a(11), b(11);

int main()
{
	cin.tie(0)->sync_with_stdio(0);
	int sa = 0, sb = 0;
	for(int i=0; i<18; i++){
		int val;
		cin>>val;
		a[val]++;
		sa += val;
	}
	for(int i=0; i<18; i++){
		int val;
		cin>>val;
		b[val]++;
		sb += val;
	}
	if(sa == sb){
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());
		if(a > b){
			cout<<"Algosia"<<nl;
		}
		else if(a < b){
			cout<<"Bajtek"<<nl;
		}
		else{
			cout<<"remis"<<nl;
		}
	}else if(sa > sb){
		cout<<"Algosia"<<nl;
	}
	else{
		cout<<"Bajtek"<<nl;
	}
	return 0;
}