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
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#include <iostream>
#include <vector>
using namespace std;

void C() {
    int n;
    int ones = 0;
    int zeros = 0;
    char ch;
    string ans;
    cin >> n;
    for (int i = 0; i < 8*n; i++){
        cin >> ch;
        if (ch=='1')ones++;
        else zeros++;
    }
    
    if (ones == 0 || zeros == 0) {
        cout << "NIE";
        return;
    }
    if (ones * 5 < 3 * zeros || ones > 3 * zeros) {
        cout << "NIE";
        return;
    }

    int h = 3 * n;
    int c = 4 * n;
    int u = 5 * n;
    int w = 6 * n;
    
    int numH = 0;
    int numC = 0;
    int numU = 0;
    int numW = 0;

    while (ones > 0 && n > 0) {
        h = 3 * n;
        c = 4 * n;
        u = 5 * n;
        w = 6 * n;

        if (ones == h) {
            numH += n;
            break;
        }
        if (ones == c) {
            numC += n;
            break;
        }
        if (ones == u) {
            numU += n;
            break;
        }
        if (ones == w) {
            numW += n;
            break;
        }

        while (ones < w) {
            ones -= 3;
            numH++;
            n--;
            h = 3 * n;
            c = 4 * n;
            u = 5 * n;
            w = 6 * n;
            if (ones > w) {
                ones += 3;
                numH--;
                n++;

                if (ones - 4 == 6 * (n - 1)) {
                    ones -= 4;
                    n--;
                    numC++;
                    break;
                }
                if (ones - 5 == 6 * (n - 1)) {
                    ones -= 5;
                    n--;
                    numU++;
                    break;
                }
                if (ones - 6 == 6 * (n - 1)) {
                    ones -= 6;
                    n--;
                    numW++;
                    break;
                }
            }
        }
    }
    for (int i = 0; i < numC; i++){
        ans += 'c';
    }
    for (int i = 0; i < numH; i++) {
        ans += 'h';
    }
    for (int i = 0; i < numU; i++) {
        ans += 'u';
    }
    for (int i = 0; i < numW; i++) {
        ans += 'w';
    }

    cout << ans;
}

void BCase() {
    int n;
    cin >> n;
    vector <bool> data(n);
    char c;
    bool b;

    for (int i = 0; i < n; i++){
        cin >> c;
        b = c == '1';
        data[i] = b;
    }
    
}

void B() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++){
        BCase();
    }
}

int main()
{
    C();
    return 0;
}