#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print(T x) {
  std::cout << x << '\n';
}
long long N;
vector<string> fun(char x, string temp) {
  char maxc = temp[0];
  for (long long i = 0; i < (temp.size()); i++) {
    if (maxc < temp[i + 1]) {
      maxc = temp[i + 1];
    }
  }
  vector<string> ans;
  char y = 'a';
  while (y <= x + 1) {
    string b{y};
    ans.push_back(temp + b);
    y = y + 1;
  }
  return ans;
}
signed main() {
  cin >> N;
  vector<string> a;
  a.push_back("a");
  vector<vector<string>> ans(N);
  ans[0] = a;
  for (long long i = 1; i < (N); i++) {
    for (auto y : ans[i - 1]) {
      vector<string> b = fun(y[y.size() - 1], y);
      for (auto x : b) {
        ans[i].push_back(x);
      }
    }
  }
  for (auto x : ans[N - 1]) {
    cout << x << endl;
  }
  return 0;
}
