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
#include "bits/stdc++.h"
 
using namespace std;
 
template<typename _T> void _debug(const char *s, _T x){ cerr << s << " = " << x << "\n";}
template<typename _T, typename... R> void _debug(const char *s, _T x, R... r){ while(*s != ',') cerr << *s++; cerr << " = " << x << ", "; _debug(s + 1, r...);}
 
#define debug(...)	_debug(#__VA_ARGS__,  __VA_ARGS__);
 
#define sz(s)	int32_t(s.size())
 
using ll = long long;
using ld = long double;
 
// #define int long long  

map < int, char > mapa;

void init(){
    for(char a = 'a'; a <= 'z'; a++){
        mapa[__builtin_popcount(a)] = a;
    }
    for(auto it: mapa){
        int ile = it.first; char lit = it.second;
        // debug(ile, lit);
    }
}

int p[2];

int32_t main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    init();
    int n;  cin >> n;
    for(int i = 0; i < 8 * n; i++){
        char a; cin >> a;
        p[a % 2]++;
    }
    vector < int > arr(n, 3);
    int o0 = p[0], o1 = p[1];
    p[0] -= n * 5, p[1] -= n * 3;
    for(int i = 0; i < n; i++){
        int cnt = min(3, p[1]);
        arr[i] += cnt, p[0] += cnt, p[1] -= cnt;
    }
    string ans;
    bool flag = true;
    for(int i = 0; i < n; i++){
        if(mapa.count(arr[i]))  ans += mapa[arr[i]];
        else flag = false;
    }
    if(!flag){
        cout << "NIE\n";
    }else{
        for(int i = 0; i < n; i++){
            o0 -= 8 - arr[i];
            o1 -= arr[i];
        }
        if(!o0 && !o1){
            cout << ans << "\n";
        }else{
            cout << "NIE\n";
        }
    }
}