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

int n, k;
char s[1 << 20];

int main(){
	scanf("%d", &n);
	scanf(" %s", s);
	
	for (int i = 0; i < (n << 3); ++i) {
		if (s[i] == '1')
			++k;
	}
	
	if (k > 6 * n || k < n * 3) {
		puts("NIE");
		return 0;
	}
	
	while (n > 0 && k - 3 <= (n - 1) * 6) {
		printf("a");
		k -= 3;
		--n;
	}
	
	while (n > 0 && k - 6 >= (n - 1) * 3) {
		printf("o");
		k -= 6;
		--n;
	}
	
	if (n > 0) {
		switch (k) {
			case 3:
				printf("a");
				break;
			case 4:
				printf("c");
				break;
			case 5:
				printf("g");
				break;
			case 6:
				printf("o");
				break;
		}
	}
	
	
	return 0;
}
/*

8
1011111010101100011011011010001010100011111111110001001001011010

*/