#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
int n;
int main() {
  int a[15];
  while (scanf("%d", &(n)) == 1) {
    for (int i = n; (i >= 1); i--) {
      int j, k;
      for (j = 1; j <= i; j++) a[j] = 0;
      for (k = j; k <= n; k++) a[k] = 1;
      do {
        int flag = 0;
        for (int p = (1); p <= (int)(n); ++p) {
          printf("%c", 'a' + a[p]);
        }
        printf("\n");
      } while (next_permutation(a + 2, a + n + 1));
    }
  }
  return 0;
}
