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
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <vector>
#include <functional>
#include <bits/stdc++.h>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cctype>
#include <bitset>

using namespace std;

int zaw1[12];
int zaw2[12];

int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

int punkty, suma1=0, suma2=0;
int sem=1;

for (int n=1; n<=18; n++)
{
  cin >> punkty;
  zaw1[punkty]=zaw1[punkty]+1;
  suma1=suma1+punkty;
}
for (int n=1; n<=18; n++)
{
  cin >> punkty;
  zaw2[punkty]=zaw2[punkty]+1;
  suma2=suma2+punkty;
}
//for (int n=0; n<=10; n++)
//  cout << zaw1[n] << " ";
//cout << endl << suma1 << endl;
//for (int n=0; n<=10; n++)
//  cout << zaw2[n] << " ";
//cout << endl << suma2 << endl;
if (suma1>suma2)
{
  cout << "Algosia";
  sem=0;
}
else
  if (suma2>suma1)
  {
    cout << "Bajtek";
	sem=0;
  }
  else
	for (int n=10; n>=0; n--)
	{
	  if (zaw1[n]>zaw2[n])
	  {
        cout << "Algosia";
		sem=0;
        break;
	  }
	  else
	  if (zaw2[n]>zaw1[n])
	  {
        cout << "Bajtek";
		sem=0;
        break;
	  }
	}
	if (sem==1)
	  cout << "remis";
return 0;

}