1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include<string>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n; string s; cin>>n>>s;
    int ile=0;
    for(int i = 0;i<s.size();++i){
        ile+=s[i]-'0';
    }
    if(ile<3*n || ile>6*n){
        cout<<"NIE"; return 0;
    }
    // 0 - a | 1 - c | 2 - g | 3 - o
    ile-=3*n;
    while(ile>=3){cout<<'o';ile-=3;--n;}
    while(ile>=2){cout<<'g';ile-=2;--n;}
    while(ile>=1){cout<<'c';ile-=1;--n;}
    while(n>0){cout<<'a';--n;}
    return 0;
}