#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Lf = long double;
using plong = pair<ll, ll>;
const int mod = 1000000007;
vector<string> S;
vector<string> ss(vector<string> S, ll N) {
  vector<string> res;
  for (ll j = 0; j < S.size(); j++) {
    char _max;
    for (ll k = 0; k < S[j].size(); k++) {
      _max = max(S[j][k], _max);
    }
    for (ll i = 0; i < _max - 'a' + 2; i++) {
      res.push_back(S[j] + (char)('a' + i));
    }
  }
  return res;
}
int main() {
  ll N;
  cin >> N;
  S.push_back("a");
  for (ll i = 2; i <= N; i++) {
    S = ss(S, i);
  }
  sort(S.begin(), S.end());
  for (ll i = 0; i < S.size(); i++) {
    cout << S[i] << "\n";
  }
}
