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
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>

const int MAX_N = 500001;
const int MIN_JEDYNEK = 3;
const int MAX_JEDYNEK = 6;

int main()
{
	int n;
	auto _ = scanf("%d\n", &n);
	int zero = 0;
	int jeden = 0;
	
	for (int i = 0; i < n * 8; i++)
	{
		char bi;
		auto _ = scanf("%c", &bi);
		if (bi == '1') jeden++;
		else zero++;
	}
	if (jeden<n * MIN_JEDYNEK || jeden > n * MAX_JEDYNEK)
	{
		printf("NIE\n");
		return 0;
	}
	int lbaza = floor(jeden / n);
	jeden -= lbaza * n;	
	char litera[] = {'a','t','u','w'}; //3,4,5,6 jedynek

	for (int i = 0; i < n; i++)
	{
		int idx = lbaza;
		if (jeden > 0)
		{
			idx++;
			jeden--;
		}
		printf("%c", litera[idx-MIN_JEDYNEK]);		
	}
	printf("\n");	
	return 0;
}