#include <bits/stdc++.h>
#pragma GCC optimize("O3", "unroll-loops")
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
inline long long int gcd(long long int a, long long int b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
inline long long int lcm(long long int a, long long int b) {
  return a / gcd(a, b) * b;
}
inline long long int gcdex(long long int a, long long int b, long long int &x,
                           long long int &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long int xx, yy;
  long long int gc = gcdex(b, a % b, yy, xx);
  x = xx;
  y = yy - (a / b) * xx;
  return gc;
}
inline long long int pwm(long long int xx, long long int pow,
                         long long int MD) {
  if (pow < 0) {
    pow = pow % (MD - 1) + MD - 1;
  }
  long long int mlt = 1;
  while (pow) {
    if (pow & 1) {
      mlt *= xx;
      mlt %= MD;
    }
    xx *= xx;
    pow >>= 1;
    xx %= MD;
  }
  return mlt;
}
inline int inv(long long int r, int _mod) {
  return pwm(r % _mod, _mod - 2, _mod);
}
inline int64_t hilbertOrder(int x, int y, int pow, int rotate) {
  if (pow == 0) {
    return 0;
  }
  int hpow = 1 << (pow - 1);
  int seg = (x < hpow) ? ((y < hpow) ? 0 : 3) : ((y < hpow) ? 1 : 2);
  seg = (seg + rotate) & 3;
  const int rotateDelta[4] = {3, 0, 0, 1};
  int nx = x & (x ^ hpow), ny = y & (y ^ hpow);
  int nrot = (rotate + rotateDelta[seg]) & 3;
  int64_t subSquareSize = int64_t(1) << (2 * pow - 2);
  int64_t ans = seg * subSquareSize;
  int64_t add = hilbertOrder(nx, ny, pow - 1, nrot);
  ans += (seg == 1 || seg == 2) ? add : (subSquareSize - add - 1);
  return ans;
}
vector<string> ans;
void choose(char c, int kolvo, string res, int after) {
  bool ok = true;
  int pust = 0;
  int first = -1;
  for (int i = 0; i < res.size(); i++) {
    if (res[i] == '-') {
      if (ok) first = i;
      ok = false;
      pust++;
    }
  }
  if (ok && kolvo == 0) {
    ans.push_back(res);
    return;
  }
  if (ok) {
    return;
  }
  if (kolvo == 0) {
    c = char(c + 1);
    res[first] = c;
    for (int i = 1; i <= pust; i++) {
      choose(c, i - 1, res, first + 1);
    }
  } else {
    for (int i = after; i < res.size(); i++) {
      if (res[i] == '-') {
        res[i] = c;
        choose(c, kolvo - 1, res, i + 1);
      }
    }
  }
}
void solve() {
  int n;
  cin >> n;
  for (int a = 1; a <= n; a++) {
    string res;
    res.assign(n, '-');
    res[0] = 'a';
    choose('a', a - 1, res, 1);
  }
  sort(ans.begin(), ans.end());
  for (auto s : ans) cout << s << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  unsigned int beg_time = clock();
  int n = 1;
  for (int i = 0; i < n; i++) solve();
  unsigned int end_time = clock();
  return 0;
}
