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
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
    int n;
    cin >> n;
    string w;
    cin >> w;
    int /*lz=0,*/lj=0;
    for(int i=0;i<n*8;i++){
        if(w[i]=='1'){
            lj++;
        }
        /*else{
            lz++;
        }*/
    }
    if(lj<3*n || lj>n*6){cout<<"NIE\n";return 0;}
    /*if(lz<2*n || lz>5*n){cout<<"NIE\n";return 0;}*/
    //cout << "1: "<< lj<< endl;
    /*int mn=min(lj,lz);
    int kj=lj,kz=lz;
    int i4=mn/4;*/
    int l3=lj/3;
    int bi=l3;
    string o="";
    if(lj%3==1){
        l3--;
        o+='e';
    }
    else if(lj%3==2){
        l3--;
        o+='g';
    }
    //cout<<"tu";
    while(bi>n){
        l3-=2;
        bi--;
        o+='w';
    }
    //cout<<"tu2";
    while(l3>0){
        l3--;
        o+='a';
    }
    cout<<o<<endl;
}