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
#include <iostream>
using namespace std;

int a[11], b[11], as, bs;

int main() 
{
	int i, x;
  for (i = 0; i < 18; i++)
  {
    cin >> x;
    a[x] ++; as += x;
  }
  for (i = 0; i < 18; i++)
  {
    cin >> x;
    b[x] ++; bs += x;
  }
  if (as > bs) { cout << "Algosia"; return 0; }
  if (as < bs) { cout << "Bajtek"; return 0; }
  for (i = 10; i > 0; i--)
  {
	if (a[i] > b[i]) { cout << "Algosia"; return 0; }
	if (a[i] < b[i]) { cout << "Bajtek"; return 0; }
  }
  
  cout << "remis";
  return 0;
}