#include <bits/stdc++.h>
using namespace std;
clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
template <typename T1, typename T2, typename T3>
struct query {
  T1 ss;
  T2 x;
  T3 y;
};
template <typename T1, typename T2, typename T3>
bool operator<(query<T1, T2, T3>& o1, query<T1, T2, T3>& o2) {
  return o1.x < o2.x;
}
template <typename T1, typename T2, typename T3>
istream& operator>>(istream& in, query<T1, T2, T3>& q) {
  in >> q.ss >> q.x >> q.y;
  return in;
}
template <typename T1, typename T2, typename T3>
ostream& operator<<(ostream& out, query<T1, T2, T3>& q) {
  out << q.ss << " " << q.x << " " << q.y;
  return out;
}
std::vector<string> V;
void get_string(string tt, long long len, string str) {
  if (len < 0) {
    V.push_back(str);
    return;
  }
  for (auto u : tt)
    str.push_back(u), get_string(tt, len - 1, str), str.pop_back();
}
void solve() {
  long long n;
  cin >> n;
  vector<string> v;
  string ss = "a";
  for (long long i = 1; i < n; i++) ss.push_back('#');
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < (1 << (n - 1)); j++) {
      if (__builtin_popcountll(j) == i) {
        string s = ss;
        long long cnt = 1;
        for (long long k = 0; k < (n - 1); k++) {
          if ((j >> k) & 1) s[k + 1] = 'a' + cnt, cnt++;
        }
        std::vector<string> tt;
        tt.push_back(s);
        set<char> st;
        for (long long k = 0; k < n;) {
          long long j = k + 1;
          st.insert(s[k]);
          while (j < n && s[j] == '#') j++;
          string temp = "", kk;
          for (auto& u : st) kk.push_back(u);
          get_string(kk, j - k - 1, temp);
          std::vector<string> ttt;
          for (auto u : tt) {
            string str = u;
            for (auto uu : V) {
              for (long long ll = k + 1; ll < j; ll++) {
                str[ll] = uu[ll - k - 1];
              }
              ttt.push_back(str);
            }
          }
          if ((long long)((V).size())) tt = ttt, V.clear();
          k = j;
        }
        for (auto u : tt) v.push_back(u);
      }
    }
  }
  sort((v).begin(), (v).end());
  for (auto u : v) {
    cout << u << '\n';
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  start = clock();
  cout << fixed << setprecision(20);
  while (t--) {
    solve();
  }
  double time_taken = double(clock() - start) / double(CLOCKS_PER_SEC);
}
