#pragma comment(linker, "/stack:247474112")
#pragma GCC optimize("Ofast")

#include <iostream>
#include <string>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <tuple>
#include <queue>
#define PII pair<int, int>
#define T3I tuple<int, int, int>
#define STA(a, b) min(a, b), max(a, b)
using namespace std;

typedef long long ll;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin >> n;
    auto func = [&](string pre, int rem, char sta, int abl, auto &Self) {
        if(rem < abl || abl == 0) {
            return;
        }else if(rem == abl) {
            cout << pre;
            for(int i = 0; i < rem; ++i) {
                cout << char(sta+i);
            }
            cout << endl;
            return;
        }
        Self(pre+sta, rem-1, sta, abl, Self);
        Self(pre+sta, rem-1, char(sta+1), abl-1, Self);
        Self(pre+char(sta+1), rem-1, char(sta+1), abl-1, Self);
    };
    for(int i = 1; i <= n; ++i) {
        func("", n, 'a', i, func);
    }
}
