#include <bits/stdc++.h>
using namespace std;
const long long kMod = 1e9 + 7;
__int32_t main() {
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  set<string> res;
  string tmp = "";
  for (__int32_t(i) = 0; (i) < (n); ++(i)) {
    tmp += "a";
  }
  while (tmp[0] == 'a') {
    res.insert(tmp);
    long long i = n - 1;
    while (i) {
      if (tmp[i - 1] >= tmp[i]) {
        ++tmp[i];
        ++i;
        while (i < n) {
          tmp[i] = 'a';
          ++i;
        }
        break;
      }
      --i;
    }
    if (!i) {
      break;
    }
    char c = 'a';
    string fix = tmp;
    i = 0;
    long long l = 0;
    long long r = 0;
    while (i < n) {
      if (fix[i] == fix[l]) {
        r = i;
      } else if (fix[i] != fix[l]) {
        for (__int32_t(j) = l; (j) < (r + 1); ++(j)) {
          fix[j] = c;
          ++c;
          l = r = i;
        }
      } else if (i == n - 1) {
        for (__int32_t(j) = l; (j) < (i + 1); ++(j)) {
          fix[j] = c;
          ++c;
          l = r = i;
        }
      }
      ++i;
    }
  }
  for (auto v : res) {
    cout << v << '\n';
  }
  return 0;
}
