#include <bits/stdc++.h>
using namespace std;
void solve(set<string> &s, vector<int> &x) {
  char id = 'a';
  int pp = 15;
  vector<char> ans(30, 0);
  for (int i = 0; i < x.size(); i++) {
    if (x[i] == -1) {
      x[i] = pp++;
      ans[x[i]] = id++;
      continue;
    }
    if (ans[x[i]]) continue;
    ans[x[i]] = id++;
  }
  string t = "";
  for (int i = 0; i < x.size(); i++) t += ans[x[i]];
  s.insert(t);
}
void dfs(set<string> &s, vector<int> &x, int n) {
  int cnt = 0;
  for (int i = 0; i < x.size(); i++) {
    cnt += x[i];
    if (x[i] == 0) {
      if (i == 0) {
        for (int j = 1; j < n; j++) {
          if (j * x.size() > n) break;
          x[i] = j;
          dfs(s, x, n);
        }
        x[i] = 0;
        return;
      }
      for (int j = x[i - 1]; j < n; j++) {
        if (cnt + j * (x.size() - i) > n) break;
        x[i] = j;
        dfs(s, x, n);
      }
      x[i] = 0;
      return;
    }
  }
  if (cnt != n) return;
  vector<int> y;
  for (int i = 0; i < x.size(); i++) {
    if (x[i] == 1) {
      y.push_back(-1);
      continue;
    }
    for (int j = 0; j < x[i]; j++) y.push_back(i);
  }
  sort(y.begin(), y.end());
  do {
    solve(s, y);
  } while (next_permutation(y.begin(), y.end()));
}
int main() {
  int n;
  cin >> n;
  set<string> s;
  string t = "";
  for (int i = 0; i < n; i++) t += "a";
  s.insert(t);
  t = "";
  for (int i = 0; i < n; i++) t += ('a' + i);
  s.insert(t);
  for (int i = 2; i <= n - 1; i++) {
    vector<int> x(i, 0);
    dfs(s, x, n);
  }
  auto ptr = s.begin();
  while (ptr != s.end()) cout << *(ptr++) << endl;
}
