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
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define pb push_back

int ile[11];
int ile2[11];

int main(){
	ll s = 0, s2 = 0;
	for(int i = 1; i <= 18; i++){
		int x;
		cin>>x;
		s += x;
		ile[x]++;
	}
	for(int i = 1; i <= 18; i++){
		int x;
		cin>>x;
		s2 += x;
		ile2[x]++;
	}
	if(s > s2){
		cout<<"Algosia"<<endl;
		return 0;
	}
	if(s2 > s){
		cout<<"Bajtek"<<endl;
		return 0;
	}
	for(int i = 10; i >= 1; i--){
		if(ile[i] > ile2[i]){
			cout<<"Algosia"<<endl;
			return 0;
		}
		if(ile2[i] > ile[i]){
			cout<<"Bajtek"<<endl;
			return 0;
		}
	}
	cout<<"remis"<<endl;
}