#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

using ll = long long int;
using pll = pair<ll, ll>;

const ll mod = static_cast<ll>(1e9) + 7;

ll N;

vector<string> T;
string S;

bool isSame(const auto& s, const auto& t)
{
    for (ll i=0;i<N;++i)
    for (ll j=i+1;j<N;++j)
    {
        const bool ss = s[i] == s[j];
        const bool tt = t[i] == t[j];
        if (ss != tt) { return false; }
    }

    return true;
}

bool isUsed(const auto& s)
{
    for (const auto& t : T)
    {
        const bool same = isSame(s, t);
        if (same) { return true; }
    }

    return false;
}

void solve(ll n, ll p)
{
    if (n == N)
    {
        // if (!isUsed(S))
        {
            T.emplace_back(S);
            cout << S << endl;
        }

        return;
    }

    rep (i, n + p)
    {
        S[n] = ('a' + i);
        solve(n + 1, (i == n ? 1 : 0));
    }
}


int main()
{
    cin >> N;
    rep (i, N) { S += 'a'; }

    solve(0, 1);

    return 0;
}
