#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

typedef long long ll;
typedef pair<ll, ll> p;

set<string> se;

void f(string s, int step, int count){
  int n = int(s.size());
  if(step == n) return;
  f(s, step+1, count);
  for(int i = 0; i < step; i++){
    // cout << i << ' ' << step << endl;
    if(count >= i){
      s[step] = s[step] + 1;
      f(s, step+1, count+1);
    }
  }
  // cout << s << endl;
  se.insert(s);
  return;
}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  string s = "";
  rep(i, n) s += "a";
  f(s, 0, 0);
  s[0]++;
  if(n > 2) se.insert(s);
  vector<string> res(ALL(se));
  sort(ALL(res));
  for(auto a : res) cout << a << endl;
}
