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

using namespace std;

int main() {
    int n, k{0};

    scanf("%d", &n);

    getchar();
    for (int i{0}; i < 8 *n; ++i) {
        char c = getchar();
        if (c == '1') ++k;
    }

    k -= 3 * n;

    if (k < 0 || 3 * n < k) {
        printf("NIE\n");
        return 0;
    }

    while (k > 2) {
        putchar('o');
        k -= 3;
        --n;
    }

    if (k == 2) {
        putchar('n');
        --n;
    }
    else if (k == 1) {
        putchar('c');
        --n;
    }

    while (n-- > 0) putchar('a');

    putchar('\n');
    return 0;
}