#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<vector<char>> ans;
  deque<vector<char>> que;
  que.push_back(vector<char>(1, 'a'));
  while (!que.empty()) {
    auto v = que.front();
    que.pop_front();
    if (v.size() == N) {
      ans.push_back(v);
      continue;
    }
    vector<bool> used(26, false);
    for (auto c : v) {
      used[c - 'a'] = true;
    }
    int idx = 0;
    for (int i = 0; i < 26; ++i) {
      if (!used[i]) {
        idx = i;
        break;
      }
    }
    v.push_back('a' + idx);
    que.push_back(v);
    for (int i = 0; i < 26; ++i) {
      if (used[i]) {
        v.back() = 'a' + i;
        que.push_back(v);
      }
    }
  }
  for (auto v : ans) {
    for (auto c : v) {
      cout << c;
    }
    cout << "\n";
  }
  return 0;
}
