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
#include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <time.h>
#include <queue>

using namespace std;

int main () {
	int n;
	scanf("%d\n", &n);
	int bits = 0;
	for (int i = 0; i < 8 * n; ++i) {
		char c;
		scanf("%c", &c);
		if (c == '1') {
			++bits;
		}
	}
	if ((bits < 3 * n) || (bits > 6 * n)) {
		printf("NIE\n");
		return 0;
	}
	int low = bits / n;
	int high_c = bits - low * n;
	char letters[] = "   acgo";
	for (int i = 0; i < n - high_c; ++i) {
		printf("%c", letters[low]);
	}
	for (int i = 0; i < high_c; ++i) {
		printf("%c", letters[low + 1]);
	}
	printf("\n");
	return 0;
}