
  #include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
//#define int long long int
using namespace std;


int main(){

  ll N; cin>>N;
  vector <vector <int> > from(1);
  from[0] = {1};
 
  if(N == 1) {cout<<"a"<<endl;return 0;}
  vector < vector <int> > to = from;

  for(int n=1;n<=N;n++){// n-1 -> n
      from = to;
      to.erase(to.begin(),to.end());
      for(int i =0;i<from.size();i++){//遷移元のdataにアクセス
          vector <int> original = from[i];
          

          for(int j=0;j<original.size();j++) original[j]++;

          vector <int> rep = {1};
          for(int j=0;j<original.size();j++) rep.push_back(original[j]);
          to.push_back(rep);
          rep = {1};
          bool changed = false;
          for(int k=2;k<=10;k++){
            for(int j=0;j<original.size();j++){
              if(k == original[j]) {
                rep.push_back(1);
                changed = true;
                continue;
              }
              rep.push_back(original[j]);
            }
            if(changed) break;
            to.push_back(rep);
            rep = {1};
          }
          

      }



  }


    vector <string> S;

    

    for(int i=0;i<to.size();i++){
        string s = "";
        for(int j=0;j<to[i].size();j++){

            s += c[to[i][j]-1];

        }
        S.push_back(s);
    }
    
    sort(S.begin(),S.end());

    for(int i=1;i<S.size();i++){
        if(S[i] != S[i-1])cout<<S[i]<<endl;
    }

  

 





  return 0;
}