#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  set<string> taken;
  vector<string> ans;
  for (int mask = 0; mask < (1 << n); mask++) {
    int cnt = 0, firstM = -1;
    string s = "";
    for (int i = 0; i < n; i++) {
      if (mask & (1 << (n - i - 1))) {
        if (firstM == -1) {
          firstM = cnt;
          cnt++;
        }
        s += char('a' + firstM);
      } else {
        s += char('a' + cnt);
        cnt++;
      }
    }
    if (taken.find(s) == taken.end()) {
      ans.push_back(s);
      taken.insert(s);
    }
  }
  reverse(ans.begin(), ans.end());
  for (string s : ans) cout << s << endl;
  return 0;
}
