#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long int int64;

int main(int argc, char **argv)
{
    int N;
    cin >> N;
    char base = 'a';

    char dig[10];
    for (int i = 0; i < N; ++i) dig[i] = (char)('a' + i);

    if (N == 1) {
        for (int i = 0; i < N; ++i) cout << dig[i];
        cout << endl;
    }
    else if (N == 2){
        for (int i = 0; i < 1; ++i) {
            for (int j = 0; j <= i + 1; ++j) {
                cout << dig[i] << dig[j] << endl;
            }
        }
    }
    else if (N == 3) {
        for (int i = 0; i < 1; ++i) {
            for (int j = 0; j <= i + 1; ++j) {
                for (int k = 0; k <= max(i + 1, j + 1); ++k) {
                    cout << dig[i] << dig[j] << dig[k] << endl;
                }
            }
        }
    }
    else if (N == 4) {
        for (int i = 0; i < 1; ++i)
            for (int j = 0; j <= i + 1; ++j)
                for (int k = 0; k <= max(i + 1, j + 1); ++k)
                    for (int l = 0; l <= max({i + 1, j + 1, k + 1}); ++l)
                    cout << dig[i] << dig[j] << dig[k] << dig[l] << endl;
    }
    else if (N == 5) {
        for (int i = 0; i < 1; ++i)
            for (int j = 0; j <= i + 1; ++j)
                for (int k = 0; k <= max(i + 1, j + 1); ++k)
                    for (int l = 0; l <= max({i + 1, j + 1, k + 1}); ++l)
                        for (int m = 0; m <= max({i + 1, j + 1, k + 1, l + 1}); ++m)
                            cout << dig[i] << dig[j] << dig[k] << dig[l] << dig[m] << endl;
    }
    else if (N == 6) {
        for (int i = 0; i < 1; ++i)
            for (int j = 0; j <= i + 1; ++j)
                for (int k = 0; k <= max(i + 1, j + 1); ++k)
                    for (int l = 0; l <= max({i + 1, j + 1, k + 1}); ++l)
                        for (int m = 0; m <= max({i + 1, j + 1, k + 1, l + 1}); ++m)
                            for (int n = 0; n <= max({i + 1, j + 1, k + 1, l + 1, m + 1}); ++n)
                            cout << dig[i] << dig[j] << dig[k] << dig[l] << dig[m] << dig[n] << endl;
    }
    else if (N == 7) {
        for (int i = 0; i < 1; ++i)
            for (int j = 0; j <= i + 1; ++j)
                for (int k = 0; k <= max(i + 1, j + 1); ++k)
                    for (int l = 0; l <= max({i + 1, j + 1, k + 1}); ++l)
                        for (int m = 0; m <= max({i + 1, j + 1, k + 1, l + 1}); ++m)
                            for (int n = 0; n <= max({i + 1, j + 1, k + 1, l + 1, m + 1}); ++n)
                                for (int o = 0; o <= max({i + 1, j + 1, k + 1, l + 1, m + 1, n + 1}); ++o)
                            cout << dig[i] << dig[j] << dig[k] << dig[l] << dig[m] << dig[n] << dig[o] << endl;
    }

    else if (N == 8) {
        for (int i = 0; i < 1; ++i)
            for (int j = 0; j <= i + 1; ++j)
                for (int k = 0; k <= max(i + 1, j + 1); ++k)
                    for (int l = 0; l <= max({i + 1, j + 1, k + 1}); ++l)
                        for (int m = 0; m <= max({i + 1, j + 1, k + 1, l + 1}); ++m)
                            for (int n = 0; n <= max({i + 1, j + 1, k + 1, l + 1, m + 1}); ++n)
                                for (int o = 0; o <= max({i + 1, j + 1, k + 1, l + 1, m + 1, n + 1}); ++o)
                                for (int p = 0; p <= max({i + 1, j + 1, k + 1, l + 1, m + 1, n + 1, o + 1}); ++p)
        cout << dig[i] << dig[j] << dig[k] << dig[l] << dig[m] << dig[n] << dig[o] << dig[p] << endl;
    }

    else if (N == 9) {
        for (int i = 0; i < 1; ++i)
            for (int j = 0; j <= i + 1; ++j)
                for (int k = 0; k <= max(i + 1, j + 1); ++k)
                    for (int l = 0; l <= max({i + 1, j + 1, k + 1}); ++l)
                        for (int m = 0; m <= max({i + 1, j + 1, k + 1, l + 1}); ++m)
                            for (int n = 0; n <= max({i + 1, j + 1, k + 1, l + 1, m + 1}); ++n)
                                for (int o = 0; o <= max({i + 1, j + 1, k + 1, l + 1, m + 1, n + 1}); ++o)
                                for (int p = 0; p <= max({i + 1, j + 1, k + 1, l + 1, m + 1, n + 1, o + 1}); ++p)
                                for (int q = 0; q <= max({i + 1, j + 1, k + 1, l + 1, m + 1, n + 1, o + 1, p + 1}); ++q)
        cout << dig[i] << dig[j] << dig[k] << dig[l] << dig[m] << dig[n] << dig[o] << dig[p] << dig[q] << endl;
    }

    else if (N == 10) {
        for (int i = 0; i < 1; ++i)
            for (int j = 0; j <= i + 1; ++j)
                for (int k = 0; k <= max(i + 1, j + 1); ++k)
                    for (int l = 0; l <= max({i + 1, j + 1, k + 1}); ++l)
                        for (int m = 0; m <= max({i + 1, j + 1, k + 1, l + 1}); ++m)
                            for (int n = 0; n <= max({i + 1, j + 1, k + 1, l + 1, m + 1}); ++n)
                                for (int o = 0; o <= max({i + 1, j + 1, k + 1, l + 1, m + 1, n + 1}); ++o)
                                for (int p = 0; p <= max({i + 1, j + 1, k + 1, l + 1, m + 1, n + 1, o + 1}); ++p)
                                for (int q = 0; q <= max({i + 1, j + 1, k + 1, l + 1, m + 1, n + 1, o + 1, p + 1}); ++q)
                                for (int r = 0; r <= max({i + 1, j + 1, k + 1, l + 1, m + 1, n + 1, o + 1, p + 1, q + 1}); ++r)
        cout << dig[i] << dig[j] << dig[k] << dig[l] << dig[m] << dig[n] << dig[o] << dig[p] << dig[q] << dig[r] << endl;
    }

    return 0;
}


Measured memory_bytes: 1536