#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using P = pair<i64, i64>;
void solve(long long N) {
  vector<vector<string>> s(2);
  s[0].push_back("a");
  for (i64 i = (1); i < (N); ++i) {
    for (i64 j = 0LL; j < (s[(i - 1) % 2].size()); ++j) {
      for (i64 k = 0LL; k < (s[(i - 1) % 2][j][i - 1] - 'a' + 2); ++k) {
        s[i % 2].push_back(s[(i - 1) % 2][j] + char('a' + k));
      }
    }
    s[(i - 1) % 2].clear();
  }
  for (i64 i = 0LL; i < (s[(N - 1) % 2].size()); ++i)
    cout << s[(N - 1) % 2][i] << endl;
}
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;
int main() {
  long long N;
  scanf("%lld", &N);
  solve(N);
  return 0;
}
