#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;
void dfs(const int& n, const int&i,  const int& p, string s, priority_queue<string, vector<string>, greater<>>& ans) {
    ans.push(s);
    for (int j=i; j<n; j++) {
        s[j] += p;
        dfs(n, j+1, p+1, s, ans);
        dfs(n, j+1, p, s, ans);
        s[j] -= p;
    }
}

int main() {
    int n;
    cin >> n;

    priority_queue<string, vector<string>, greater<>> ans;
    string s = string(n, 'a');
    dfs(n, 1, 1, s, ans);
    map<string, bool> mp;
    while(!ans.empty()) {
        if (!mp[ans.top()]) {
            cout << ans.top() << endl;
            mp[ans.top()] = true;
        }
        ans.pop();
    }
}