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
//

#include <bits/stdc++.h>

using namespace std;

#define int long long

constexpr int sizik = 1000 * 1001;

#define ar std::array
#define pr std::pair
#define vec std::vector

typedef vec<vec<int>> _kra;

#define A std::cout << "Algosia\n"
#define B std::cout << "Bajtek\n"

void solve() {
    std::map<int, int> m1, m2;
    int s1 = 0, s2 = 0;

    for (int i = 0; i < 18; i++) {
        int a;
        std::cin >> a;

        s1 += a;
        m1[a]++;
    }

    for (int i = 0; i < 18; i++) {
        int a;
        std::cin >> a;

        s2 += a;
        m2[a]++;
    }

    if (s1 > s2) {
        A;
    } else if (s1 < s2) {
        B;
    } else {
        for (int i = 10; i >= 1; i--) {
            if (m1[i] > m2[i]) {
                A;
                return;
            } else if (m1[i] < m2[i]) {
                B;
                return;
            }
        }

        std::cout << "remis\n";
    }
}

int32_t main() {
    std::ios_base::sync_with_stdio(0);
    std::cin.tie(0);
    std::cout.tie(0);

    int t = 1;
    // std::cin >> t;

    for (; t > 0; t--) {
        solve();
    }

    return 0;
}