#include <bits/stdc++.h>
using namespace std;
int max_n;
void dfs(int n, string t, int m) {
  char tmp;
  for (int i = 0; i < (max_n - n) + 1; i++) {
    tmp = 97 + i;
    if (i <= m + 1) {
      string p = t + tmp;
      int k = n - 1;
      if (!k) cout << p << endl;
      if (k > 0) dfs(k, p, i);
    } else
      break;
  }
}
int main() {
  cin >> max_n;
  string t = "";
  dfs(max_n, t, 0);
  return 0;
}
