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

using namespace std;

int main(){
    ios_base::sync_with_stdio(0);
    char c;
    int n,cnt=0;
    cin >> n;
    for(int i=0; i<8*n; ++i){
        cin >> c;
        if(c == '1')
            ++cnt;
    }
    if(cnt < n*3 || cnt > 6*n){
        cout << "NIE";
        return 0;
    }
    cnt -= n*3;
    for(int i=0; i<n; ++i){
        if(cnt>=3){
            cout << 'o';
            cnt -= 3;
        }else if(cnt == 2){
            cout << 'n';
            cnt -= 2;
        }else if(cnt == 1){
            cout << 'c';
            cnt -= 1;
        }else{
            cout << 'a';
        }
    }
    return 0;
}