
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

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

#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double d;
typedef long long ll;

const int N=2e5+5;
const int mod=1e9+7;

int n;
vector<string>v;
void rec(int i,string s){
    if(i==n){
        int maxi=0;
        bool ok[10]{0};
        for(char c:s){
            ok[c-'a']=1;
            maxi=max(maxi,int(c-'a'));
        }
        rep(j,0,maxi){
            if(!ok[j]) return;
        }
        v.pb(s);
        return;
    }
    rep(j,0,i){
        rec(i+1,s+char('a'+j));
    }
}
signed main(){
    FastIO;
    cin>>n;
    rec(0,"");
    sort(all(v));
//    cout<<v.size();
    for(string s:v) cout<<s<<'\n';
    return 0;
}
