#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
const long long INF = (1LL << 60LL);
vector<string> r(string in, int max) {
  vector<string> result;
  if (in.size() == max) {
    result.emplace_back(in);
    return result;
  }
  char last = in[in.size() - 1];
  auto plus1 = r(in + last, max);
  for (auto e : plus1) {
    result.emplace_back(e);
  }
  auto plus2 = r(in + char(last + 1), max);
  for (auto e : plus2) {
    result.emplace_back(e);
  }
  if (last > 'a') {
    auto plus3 = r(in + char(last - 1), max);
    for (auto e : plus3) {
      result.emplace_back(e);
    }
  }
  return result;
}
int main() {
  long long N;
  scanf("%lld", &N);
  vector<string> list = r("a", N);
  sort(list.begin(), list.end());
  for (long long i = 0; i < list.size(); i++) {
    cout << list[i] << endl;
  }
}
