#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  queue<string> que, ans;
  que.push("a");
  while (que.size()) {
    string t = que.front();
    que.pop();
    if (t.length() == n) {
      ans.push(t);
      continue;
    }
    for (int i = 0; i < (int)(t.at(t.length() - 1) - 'a') + 2; i++) {
      que.push(t + (char)('a' + i));
    }
  }
  while (ans.size()) {
    string s = ans.front();
    ans.pop();
    cout << s << endl;
  }
}
