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
#include <iostream>
#include <string>
using namespace std;

int main()
{
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(false);
	
	string s;
	int n;
	cin>>n>>s;
	
	int zero=0, one=0;
	
	for(int i=0;i<8*n;i++)
	{
		if(s[i]=='0')
		{
			zero++;
		}
	}
	one=8*n-zero;
	if(zero<2*n||one<3*n)
	{
		cout<<"NIE";
		return 0;
	}
	else
	{
		zero-=2*n;
		one-=3*n;
		while(zero>2)
		{
			cout<<"a";
			zero-=3;
		}
		while(one>2)
		{
			cout<<"w";
			one-=3;
		}
		if(one==2)
		{
			cout<<"s";
			return 0;
		}
		if(one==1)
		{
			cout<<"q";
		}
	}
}