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
#include <iostream>
#define ll long long
using namespace std;
ll n,x,x1,sum;
char k;
int main()
{
    std::ios_base::sync_with_stdio(0);
    cin>>n;
    for(int i=1; i<=8*n; i++){
        cin>>k;
        if(k=='0')
            sum++;
    }
    x=5*n;
    x1=2*n;
    if(sum>x || sum<x1){
        cout<<"NIE";
        return 0;
    }
    sum-=x1;
    for(int i=1; i<n; i++)
    if(sum>=3){
        sum-=3;
        cout<<"a";
    }
    else
        cout<<"w";
    if(sum==0)
        cout<<"w";
    if(sum==1)
        cout<<"g";
    if(sum==2)
        cout<<"c";
    return 0;
}