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

//#define int long long
#define st first
#define nd second
#define bg begin
#define ed end
#define pb push_back
#define all(r) bg(r),ed(r)
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) 

int32_t main(){
	fast;
	int n;
	cin>>n;
	int a=0;
	int b=0;
	for(int i=0;i<n*8;i++){
		char x;
		cin>>x;
		if(x=='1'){
			a++;
		}else{
			b++;
		}
	}
	string res;
	while(a>0&&b>0){
		if(a-b>=4){
			a-=6;
			b-=2;
			res+='w';
		}else
		if(a-b==2){
			a-=5;
			b-=3;
			res+='g';
		}else
		if(a==b){
			a-=4;
			b-=4;
			res+='c';
		}else{
			a-=3;
			b-=5;
			res+='a';
		}
		//cout<<a<<' '<<b<<'\n';
	}
	if(a==b){
		cout<<res<<'\n';
	}else{
		cout<<"NIE"<<'\n';
	}
}