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
#include <bits/stdc++.h>
using namespace std;
//#define int long long
constexpr int maxN = 20+7;

int n=18,suma,sumb,a[maxN],b[maxN];

int32_t main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	for(int i=1;i<=n;i++){
		cin>>a[i];
		suma += a[i];
	}
	for(int i=1;i<=n;i++){
		cin>>b[i];
		sumb += b[i];
	}
	if(suma != sumb){
		cout<<((suma > sumb) ? "Algosia\n" : "Bajtek\n");
		return 0;
	}
	sort(a+1, a+1+n, greater<int>());
	sort(b+1, b+1+n, greater<int>());
	for(int i=1;i<=n;i++){
		if(a[i] != b[i]){
			cout<<((a[i] > b[i]) ? "Algosia\n" : "Bajtek\n");
			return 0;
		}
	}
	cout<<"remis\n";
}
/*
 
4
2 1 4 3
4
2 1
1 4 5
2 2
1 5 1



*/