#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
char a[20];
int n;
char up;
int vis[20];
void dfs(int i) {
  if (i == 0) return;
  while (a[i] <= up) {
    vis[a[i] - 'a']--;
    a[i]++;
    vis[a[i] - 'a']++;
    printf("%s\n", a);
  }
  while (i > 0 && vis[a[i] - 'a'] == 1) i--;
  if (i == 0) return;
  vis[a[i] - 'a']--;
  a[i]++;
  vis[a[i] - 'a']++;
  up = max(up, a[i]);
  for (int j = i + 1; j <= n - 1; j++) {
    vis[a[j] - 'a']--;
    a[j] = 'a';
    vis[0]++;
  }
  printf("%s\n", a);
  dfs(n - 1);
}
void solve() {
  scanf("%d", &n);
  for (int i = 0; i <= n - 1; i++) a[i] = 'a', vis[a[i] - 'a']++;
  up = 'a';
  printf("%s\n", a);
  dfs(n - 1);
}
int main() {
  solve();
  return 0;
}
