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

const int N = 1e5 + 10;
const char B[4] = {'a', 'c', 'g', 'w'};

int n, m;
char s[8*N + 1];

void put(char c, int count) {
  while (count--) putchar(c);
}

int main() {
  scanf("%d%s", &n, s);
  for (int i = 0; s[i]; ++i) m += s[i] - '0';
  if (3*n <= m && m <= 6*n) {
    m -= 3*n;
    put(B[3], m/3);
    put(B[m%3], bool(m%3));
    put(B[0], n - m/3 - bool(m%3));
    putchar('\n');
  } else {
    puts("NIE");
  }
  return 0;
}