#include <bits/stdc++.h>
using namespace std;
int main() {
  long n, i, j, max, r;
  cin >> n;
  r = 1;
  for (i = 1; i <= n; i++) {
    r = r * i;
  }
  int S[r][n];
  for (j = 0; j < n; j++) {
    S[0][j] = 0;
  }
  for (i = 1; i < r; i++) {
    for (j = 0; j < n - 1; j++) {
      S[i][j] = S[i - 1][j];
    }
    S[i][n - 1] = S[i - 1][n - 1] + 1;
    for (j = n - 1; j >= 1; j--) {
      if (S[i][j] - S[i][j - 1] > 1) {
        S[i][j] = 0;
        S[i][j - 1] = S[i][j - 1] + 1;
      }
    }
    if (S[i][n - 1] == n - 1) {
      break;
    }
  }
  for (i = 0; i < r; i++) {
    for (j = 0; j < n; j++) {
      cout << (char)(97 + S[i][j]);
    }
    cout << endl;
    if (S[i][n - 1] == n - 1) {
      break;
    }
  }
}
