#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", ans);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

vector<string> ans;
int n;
vector<char> al;

void dfs(string s = "a", int cnt = 1) {
    if (cnt == n) {
        ans.pb(s);
        return;
    }
    for (int i = 0; i <= (s[s.size() - 1] - 'a') + 1; i++) {
        dfs(s + al[i], cnt + 1);
    }
}


int main(void) {
    cin >> n;

    for (char c = 'a'; c <= 'z'; c++) al.pb(c);

    dfs();

    sort(rng(ans));

    rep (i, ans.size()) cout << ans[i] << endl;
    return 0;
}
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", ans);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

vector<string> ans;
int n;
vector<char> al;

void dfs(string s = "a", int cnt = 1) {
    if (cnt == n) {
        ans.pb(s);
        return;
    }
    for (int i = 0; i <= (s[s.size() - 1] - 'a') + 1; i++) {
        dfs(s + al[i], cnt + 1);
    }
}


int main(void) {
    cin >> n;

    for (char c = 'a'; c <= 'z'; c++) al.pb(c);

    dfs();

    sort(rng(ans));

    rep (i, ans.size()) cout << ans[i] << endl;
    return 0;
}
