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

const char C[] = {' ', ' ', ' ', 'a', 'c', 'n', 'o'};

const int N = 1e5 + 5;

int n;
char S[8 * N];

int main() {
	scanf("%d", &n);
	scanf("%s", &S);
	int mn = 3 * n;
	int mx = 6 * n;
	int ile = 0;
	for (int i = 0; i < 8 * n; i++) {
		ile += S[i] == '1';
	}
	if (ile < mn || mx < ile) {
		printf("NIE\n");
		return 0;
	}
	ile -= 3 * n;
	for (int i = 0; i < n; i++) {
		int dod = min(3, ile);
		ile -= dod;
		printf("%c", C[3 + dod]);
	}
	printf("\n");
}