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
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll INF = 1000000000000000;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;

    char x;
    int num = 0;
    for (int i = 1; i <= 8 * n; i++) {
        cin >> x;
        if (x == '1') {
            num++;
        }
    }

    if (num >= 3 * n && num < 4 * n) {
        int rem = num - 3 * n;
        for (int i = 1; i <= n - rem; i++) {
            cout << 'a';
        }
        for (int i = 1; i <= rem; i++) {
            cout << 'c';
        }
        cout << "\n";
    }
    else if (num >= 4 * n && num < 5 * n) {
        int rem = num - 4 * n;
        for (int i = 1; i <= n - rem; i++) {
            cout << 'c';
        }
        for (int i = 1; i <= rem; i++) {
            cout << 'g';
        }
        cout << "\n";
    }
    else if (num >= 5 * n && num < 6 * n) {
        int rem = num - 5 * n;
        for (int i = 1; i <= n - rem; i++) {
            cout << 'g';
        }
        for (int i = 1; i <= rem; i++) {
            cout << 'o';
        }
        cout << "\n";
    }
    else if (num == 6 * n) {
        for (int i = 1; i <= n; i++) {
            cout << 'o';
        }
        cout << "\n";
    }
    else {
        cout << "NIE\n";
    }


    return 0;
}