#include <bits/stdc++.h>
int a[20];
int n;

void dfs(int step, int x) {
    if (step == n) {
        for (int i = 0; i < n; i++) {
            cout << char('a' + a[i]);
        }
        cout << endl;
        return;
    }
    for (int i = 0; i <= x + 1; i++) {
        a[step] = i;
        dfs(step + 1, max(x, i));
    }
}

int main(void) {
    cin >> n;
    a[0] = 0;
    dfs(1, 0);
    return 0;
}
