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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
char alpha[11];
int n;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> n;
    rep(i,0,n) alpha[i] = 'a' + i;
    int ans[n+1]={};
    ans[n] = -1;
    bool end=true;
    while(end){
        rel(i,n,0) cout << alpha[ans[i]];
        cout << endl;
        int mov=0;
        while(true){
            if(ans[mov+1]>=ans[mov]){ ans[mov]++; break;}
            else{
                rep(i,0,mov) ans[i] = 0;
                mov++;
                if(mov==n){ end = false; break;}
            }
        }
    }
}