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
//ANMHLIJKTJIY!
#pragma GCC optimize(2)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline","fast-math","unroll-loops","no-stack-protector")
#pragma GCC diagnostic error "-fwhole-program"
#pragma GCC diagnostic error "-fcse-skip-blocks"
#pragma GCC diagnostic error "-funsafe-loop-optimizations"
#include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 998244353
#define F first
#define S second
#define ll long long
#define N 100010
using namespace std;
ll sum1=0,sum2=0,a[20],b[20];
int main(){
	ll i,x;
	for(i=0;i<18;i++)
	{
		cin>>x;
		sum1+=x;
		a[x]++;
	}
	for(i=0;i<18;i++)
	{
		cin>>x;
		sum2+=x;
		b[x]++;
	}
	vector<ll> seq1,seq2;
	seq1.push_back(sum1);
	for(i=10;i>=0;i--)
	{
		seq1.push_back(a[i]);
	}
	seq2.push_back(sum2);
	for(i=10;i>=0;i--)
	{
		seq2.push_back(b[i]);
	}
	if(seq1>seq2)
	{
		puts("Algosia");
	}
	else if(seq1<seq2)
	{
		puts("Bajtek");
	}
	else
	{
		puts("remis");
	}
	return 0;
}