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
#include <stdio.h>
#include <stdlib.h>

#define N 800000

char bits[N];

void nope() {
    printf("NIE\n");
    exit(0);
}

int main() {
    int n;
    scanf("%d", &n);
    scanf(" %s", bits);
    int zeros = 0, ones = 0;
    for (int i = 0; i < 8 * n; ++i) {
        if (bits[i] == '0') {
            zeros++;
        } else {
            ones++;
        }
    }
    if (zeros < 2 * n) {
        nope();
    }
    zeros -= 2 * n;
    if (ones < 3 * n) {
        nope();
    }
    ones -= 3 * n;
    while (zeros >= 3) {
        printf("a");
        zeros -= 3;
    }
    while (ones >= 3) {
        printf("o");
        ones -= 3;
    }
    if (ones == 1) {
        printf("c");
    } else if (ones == 2) {
        printf("g");
    }
    printf("\n");
    return 0;
}