#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
void YESNO(bool), YesNo(bool);
template <class T1, class T2>
bool chmin(T1 &l, const T2 &r);
template <class T1, class T2>
bool chmax(T1 &l, const T2 &r);
vector<string> f(char a, long long int N) {
  string s = "";
  if (N == 0) return vector<string>(1, s);
  vector<string> ans;
  for (long long int i = N - 1; i >= 0; i--) {
    s += a;
    auto t = f(a + 1, i);
    for (auto ss : t) {
      ans.push_back(s + ss);
    }
  }
  return ans;
}
void solve(long long N) {
  string s = "";
  for (lli i = 0; i < (N); i++) s += 'a' + i;
  vector<string> cur;
  cur.push_back("");
  for (lli i = (N)-1; i >= 0; i--) {
    vector<string> nxt;
    for (auto &s : cur) {
      for (lli j = 0; j < (i + 1); j++) {
        char c = ('a' + j);
        nxt.push_back(c + s);
      }
    }
    cur = move(nxt);
  }
  for (auto s : cur) {
    cout << s << endl;
  }
}
signed main() {
  long long N;
  scanf("%lld", &N);
  solve(N);
  return 0;
}
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
template <class T1, class T2>
bool chmin(T1 &l, const T2 &r) {
  return (l > r) ? (l = r, true) : false;
}
template <class T1, class T2>
bool chmax(T1 &l, const T2 &r) {
  return (l < r) ? (l = r, true) : false;
}
