#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve(ll N) {
  string s;
  for (int i = 0; i < N; ++i) s += 'a';
  vector<string> ans;
  ans.push_back(s);
  for (int i = 1; i < N; ++i) {
    for (int j = N - 1; j >= i; --j) {
      s[j]++;
      ans.push_back(s);
      while (next_permutation(s.begin() + i, s.end())) {
        ans.push_back(s);
      }
    }
  }
  sort(ans.begin(), ans.end());
  for (string s : ans) {
    cout << s << endl;
  }
}
int main() {
  ll N;
  cin >> N;
  solve(N);
  return 0;
}
