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

#define FOR(i, n) for (int i = 0; i < int(n); ++i)
#define FO(i, a, b) for (int i = (a); i < int(b); ++i)
#define OF(i, a, b) for (int i = (b)-1; i >= int(a); --i)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((b) < (a) ? (a) : (b))

#define REMIN(a, b) ((a) = min(a, b))
#define REMAX(a, b) ((a) = max(a, b))

#define ALL(c) (c).begin(), (c).end()

#define SQR(x) ((x) * (x))

//

int main() {
  ios_base::sync_with_stdio(0);

  int n;

  cin >> n;

  string s;
  cin >> s;

  int num1 = 0;

  for (auto& c : s)
    if (c == '1') ++num1;

  if (num1 / n < 3 || num1 / n + (num1 % n != 0) > 6) {
    cout << "NIE" << endl;
    return 0;
  }

  char chars[8];
  chars[3] = 'a';
  chars[4] = 'c';
  chars[5] = 'g';
  chars[6] = 'o';

  FOR(i, num1 % n) { cout << chars[num1 / n + 1]; }

  FOR(i, n - num1 % n) { cout << chars[num1 / n]; }
  cout << endl;

  return 0;
}