1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include <bits/stdc++.h>
using namespace std;
vector<char> t = {'a', 'c', 'g', 'o'};

int main(){
	int n;
	string s;
	cin >> n >> s;
	int l1 = 0;
	for(int i=0; i<s.size(); i++)
		l1 += (s[i] == '1') ? 1 : 0;
	l1 -= 3 * n;
	if(l1 < 0 || 3 * n < l1)
		cout << "NIE";
	else
		for(int i=0; i<n; l1-=min(3,l1),  i++)
			cout << t[min(3,l1)];
	cout << "\n";
}