#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<stack>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
#define MAX 510000
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
using namespace std;

int factorial(int n){
  int x=1;
  for(int i=1; i<=n; ++i)　x*=i;
  return x;
}

int main(){
  int N;
  char mx='a';
  cin>>N;
  deque<string> L;
  L.push_back("a");
  
  while(L.size()!=factorial(N)){
    string S=L.front();
    L.pop_front();
    
    for(int i=0; i<S.size(); ++i){
      if(mx<S.at(i)) mx=S.at(i);
    }
    
    for(int i='a'; i<=mx+1; ++i){
      cout<<S+i<<endl;
      L.push_back(S+i);
    }
  }
  
}