#include <bits/stdc++.h>
using namespace std;
signed main() {
  int n;
  cin >> n;
  n--;
  vector<string> now{"a"};
  while (n--) {
    vector<string> next;
    for (auto const &s : now) {
      int c = *max_element(s.begin(), s.end()) - 'a';
      for (int i = 0; i < c + 1; i++) {
        next.push_back(s + (char)(i + 97));
      }
    }
    now = next;
  }
  sort(now.begin(), now.end());
  for (auto const &s : now) cout << s << endl;
  return 0;
}
