#include <bits/stdc++.h>
inline int read() {
  register int x = 0, p = 1;
  register char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') {
      p = -1;
    }
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0', ch = getchar();
  }
  return x * p;
}
int n, a[15];
bool book[15];
void dfs(int step) {
  if (step == n) {
    for (register int i = 1; i <= n; ++i) {
      putchar(a[i] + 'a' - 1);
    }
    putchar('\n');
    return;
  }
  for (register int i = 1; i <= n; ++i) {
    if (book[i]) {
      a[step + 1] = i, dfs(step + 1);
    } else if (i <= a[step] + 1 && i >= a[step]) {
      book[i] = true, a[step + 1] = i, dfs(step + 1), book[i] = false;
    }
  }
}
int main() {
  n = read(), a[1] = 1, book[1] = true, dfs(1);
  return 0;
}
