#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, neg = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  return x * neg;
}
inline void print(int x) {
  if (x < 0) {
    putchar('-');
    print(abs(x));
    return;
  }
  if (x <= 9)
    putchar(x + '0');
  else {
    print(x / 10);
    putchar(x % 10 + '0');
  }
}
inline int qpow(int x, int e, int _MOD) {
  int ans = 1;
  while (e) {
    if (e & 1) ans = ans * x % _MOD;
    x = x * x % _MOD;
    e >>= 1;
  }
  return ans;
}
int n = read();
vector<string> v;
int a[15], pre[15];
inline void dfs2(int x, int t) {
  if (x == n + 1) {
    memset(pre, 0, sizeof(pre));
    for (int i = n; i >= 1; i--) pre[a[i]] = i;
    bool flag = 1;
    for (int i = 1; i <= t; i++)
      if (pre[i] < pre[i - 1]) flag = 0;
    if (flag) {
      string t;
      for (int i = 1; i <= n; i++) t.push_back(a[i] + 'a' - 1);
      v.push_back(t);
    }
    return;
  }
  if (a[x]) {
    dfs2(x + 1, t);
    return;
  }
  for (int i = 1; i <= t; i++) {
    a[x] = i;
    dfs2(x + 1, t);
  }
}
inline void dfs(int x, int lst, int t) {
  if (x == t + 1) {
    dfs2(1, t);
    return;
  }
  for (int i = lst + 1; i <= n; i++) {
    a[i] = x;
    dfs(x + 1, i, t);
    a[i] = 0;
  }
}
signed main() {
  for (int i = 1; i <= n; i++) {
    dfs(1, 0, i);
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) {
    if (i == 0 || v[i] != v[i - 1]) cout << v[i] << endl;
  }
  return 0;
}
