#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, count = 1;
  string s, last;
  vector<char> alp = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'};
  vector<string> dic;
  cin >> n;
  for (int i = 0; i < (n); i++) s.append("a");
  dic.push_back(s);
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < n - count; j++) {
      sort(s.begin(), s.end());
      s[n - j - 1] = alp[count];
      do {
        if (s[0] == 'a') dic.push_back(s);
      } while (next_permutation(s.begin(), s.end()));
    }
    count++;
  }
  for (int i = 0; i < (n); i++) last.append("a");
  for (int i = 0; i < (n); i++) last[i] = 'a' + i;
  dic.push_back(last);
  sort(dic.begin(), dic.end());
  for (int i = 0; i < (dic.size()); i++) {
    cout << dic[i] << endl;
    if (dic[i] == last) break;
  }
  return 0;
}
