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

using namespace std;

int main(){
    vector<int>tab;
    int n,sum=0;
    char c;
    cin >> n;
    for(int i=0;i<n*8;i++){
        cin >> c;
        tab.push_back(c-'0');
        sum += (c - '0');
    }
    if(sum >= 3*n && sum <= 6*n){
        for(int i=0;i<n;i++){
            if(sum > (n-i) * 3){
                if(sum - 6 >= (n - i - 1) * 3){
                    cout << "o";
                    sum -= 6;
                }
                else if(sum - 5 == (n - i - 1) * 3){
                    cout << "n";
                    sum -=5;
                }
                else if(sum - 4 == (n - i - 1) * 3){
                    cout << "j";
                    sum -= 4;
                }
            }
            else{
                cout << "b";
                sum -= 3;
            }
        }
    }
    else{
        cout << "NIE" << endl;
    }
}