#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
set<string> st, p;
map<string, long long> mp;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  long long n;
  cin >> n;
  string s = "";
  for (long long i = 0; i < n; i++) s += 'a';
  p.insert(s);
  st.insert(s);
  while (!p.empty()) {
    string t = *p.begin();
    p.erase(p.begin());
    for (long long j = 1; j < (1LL << n) - 1LL; j++) {
      string res = t;
      long long ind[26] = {0LL};
      for (long long k = 0; k < n; k++) {
        if (j & (1LL << k)) {
          if (res[k] + 1 <= 'j') {
            res[k]++;
          } else {
            goto home;
          }
        }
      }
      {
        char cnt = 'a';
        for (char x : res) {
          if (ind[x - 'a'] == 0LL) {
            ind[x - 'a'] = cnt++;
          }
        }
        for (long long i = 0; i < n; i++) res[i] = ind[res[i] - 'a'];
        if (st.find(res) == st.end()) {
          p.insert(res);
          st.insert(res);
        }
      }
    home:;
    }
  }
  for (string x : st) {
    cout << x << '\n';
  }
  return 0;
}
