#include <bits/stdc++.h>
const int MAXN = 11;
char s[MAXN];
int N;
int visit[MAXN];
bool check() {
  memset(visit, 0, sizeof(visit));
  for (int i = 0; i < N; ++i) {
    visit[s[i] - 'a'] = 1;
  }
  int sum = 0;
  for (int i = N - 1; i >= 0; --i) {
    if (visit[i] == 1) {
      sum = i + 1;
      break;
    }
  }
  int val = 0;
  for (int i = 0; i < N; ++i) {
    val += visit[i];
  }
  return sum == val;
}
void dfs(int h) {
  if (h == N) {
    s[N + 1] = '\0';
    if (check()) {
      printf("%s\n", s);
    }
    return;
  }
  for (int i = 'a'; i <= 'a' + h; ++i) {
    s[h] = i;
    dfs(h + 1);
  }
}
int main() {
  scanf("%d", &N);
  dfs(0);
  return 0;
}
