#include <bits/stdc++.h>
using namespace std;
const unsigned long long base = 1314;
int n, T, a[5007], num[5007], pre[5007];
map<unsigned long long, int> mp;
inline int read() {
  int x = 0;
  int flag = 1;
  char ch;
  ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + ch - 48;
    ch = getchar();
  }
  return x * flag;
}
inline void dfs(int x, int dep) {
  if (dep == 0) {
    int minn = 777;
    unsigned long long sum = 0;
    for (register int i = n; i >= 1; i--) {
      minn = min(a[i], minn);
    }
    for (register int i = n; i >= 1; i--) {
      sum = base * sum + a[i] + 'a' - minn;
    }
    if (!mp[sum]) {
      mp[sum] = 1;
      for (register int i = n; i >= 1; i--) {
        printf("%c", a[i] + 'a' - 1);
      }
      cout << endl;
    }
    return;
  }
  for (register int i = 1; i <= n; i++) {
    if (a[dep + 1] > i || !pre[i - 1]) continue;
    a[dep] = i;
    pre[i]++;
    dfs(i, dep - 1);
    pre[i]--;
  }
}
int main() {
  n = read();
  pre[0] = 1;
  dfs(n, n);
  return 0;
}
