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
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#include <bits/stdc++.h>
#define FOR(i,n) for(int i = 0; i<n; ++i)
#define FOREACH(v, a) for(auto & v : (a))
#define X first
#define Y second
#define PR std::pair
#define MPR std::make_pair
typedef long long ll;
typedef std::vector<int> VI;

using namespace std;

#pragma region Ready functions

int fastPower(int a, int b){
    int res=1, pop_a = a;
    while(b){
        if(b&1) res *= pop_a;
        pop_a *= pop_a;
        b>>=1;
    }
    return res;
}

#pragma endregion


int currentLetter;
vector<char> litery;

int requiredBits[26];

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    
    void prep();

    int n;
    string thisS;

    cin>>n;

    bool nie = false;

    int ile1 = 0;
    int ile0 = 0;

    FOR(i, 8*n){
        char x;
        cin>>x;
        thisS.push_back(x);
        if(x=='0') ile0++;
        else ile1++;
    }

    ile0 -= n;
    ile1 -= n*2;

    //cout<<ile0<<" "<<ile1<<endl;

    if(ile0 < 0 || ile1 < 0){
        cout<<"NIE";
        return 0;
    }

    while(ile0 > 0 && ile1 > 0){
        if(ile0 - ile1 >= 3){
            ile0 -= 4;
            ile1 -= 1;
            litery.push_back('a');
        }
        else if(ile0 - ile1 >= 1){
            ile0 -= 3;
            ile1 -= 2;
            litery.push_back('c');
        }
        else if(ile1 - ile0 >= 3){
            ile1 -= 4;
            ile0 -= 1;
            litery.push_back('o');
        }
        else if(ile1 - ile0 >= 1){
            ile1 -= 3;
            ile0 -= 2;
            litery.push_back('g');
        }
        else{
            ile0 -= 3;
            ile1 -= 2;
            litery.push_back('c');
        }

        //cout<<ile0<<" "<<ile1<<endl;
    }

    if(ile0 > 0 && ile0 == ile1){
        cout<<"NIE";
        return 0;
    }
    else if(ile0>0 || ile1>0){
        cout<<"NIE";
        return 0;
    }

/*
    string newStr;
*/
    for(char v : litery){
        cout<<v;
        int z = (int)v;
/*
    
        while(z){
            newStr.push_back('0' + z%2);
            z/=2;
        }
        newStr.push_back('0');*/
    
    }
    
    //cout<<endl;

    /*
    FOR(i,n){

    }*/
/*
    sort(newStr.begin(), newStr.end());
    sort(thisS.begin(), thisS.end());

    cout<<newStr<<"\n";
    cout<<thisS<<"\n";


    if(newStr == thisS){
        cout<<endl;
        cout<<"Good"<<endl;
    }
    else cout<<"\nBad\n";

*/
}