#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    int n; cin >> n;
    vector<string> ans;
    auto rec = [&](auto &&rec, int b, string s) -> void {
        if (s.size()==n) {
            ans.push_back(s);
            return;
        }
        rep(i,b+1) {
            string t = s;
            t += 'a'+i;
            // cout << t << " " << i << endl;
            rec(rec, i+1, t);
        }
    };

    rec(rec, 1, "a");
    sort(ans.begin(), ans.end());
    rep(i,ans.size()) {
        cout << ans[i] << endl;
    }
    return 0;
}