#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"
#define  st first
#define  nd second
#define int unsigned long long 

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef cc_hash_table<int, int, hash<int > > ht;

const int  M    =  998244353;
const int  maxn =  100001   ;
const int  inf  =  1e16     ;
const long double eps = 1.084202e-19;
set<string> se ; 
void recur ( string s , int n ) {
   if(s.size()==n){
      se.insert(s);
      return ; 
   }
   char stt= 'a';
   char en = 'a'+s.size();
   while(stt<=en){
       recur(s+stt,n);
       stt++;
   }
   
}

int32_t main()
{
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      int n ; 
      cin >> n ;
      string s="a" ;
      recur(s,n);
      int t = se.size();
      map < vector<int> , bool > m ; 
      vector<string> ans ; 
      for( auto j : se ){
          set<char> s;
          string x = j ;
          sort(j.begin(),j.end());
          for(auto i : j ){
             s.insert(i);
          }
          int i = 0 ;
          map<char,int> mm ;
          for(auto k : s){
              mm[k]=i++;
          }
          vector<int> v;
          for(auto i : j ){
              v.push_back(mm[i]);
          }
          if(m[v]==false){
               ans.push_back(x);
               m[v]=true;
          }

      }
      for(auto j:ans)
        cout << j <<"\n" ;
         
return 0;
}  