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
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = b; a <= i; i--)
#define cat(x) cerr << #x << " = " << x << '\n';
using ll = long long;
using namespace std;

int n;
string s, t = "acgo";

int main() {
	cin.tie(0)->sync_with_stdio(0);

	cin >> n >> s;

	int cnt = count(s.begin(), s.end(), '1') - 3 * n;

	if (0 <= cnt && cnt <= 3 * n) {
		while (n--) {
			cout << t[min(cnt, 3)];
			cnt = max(0, cnt - 3);
		}
	}
	else {
		cout << "NIE\n";
	}

	return 0;
}