#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define collect(arr, size) rep(i,size) cin >> arr[i];
#define int long long

priority_queue<string, vector<string>, greater<>> q;

void buildstring(int n, string s="", char maxchar = 'a'){
    if(n==s.length()){
        q.push(s);
        return;
    }
    rep(i,maxchar-'a'+1){
        buildstring(n,s+(char)('a'+i),('a'+i));
    }
    if(s!="") buildstring(n,s+(char)(maxchar+1),maxchar+1);
}

signed main(){
    int N; cin >> N;
    buildstring(N);
    while(!q.empty()){
        printf("%s\n",q.top().c_str());
        q.pop();
    }
}