#include <iostream>
#include <vector>
#include <string>

std::vector<std::string> solv(int N) {
  if (N == 1) return {"a"};

  auto const& rec = solv(N-1);

  for (auto const& s : solv(N-1)) {
    std::string t;
    char d='a';
    for (auto const c : s) {
      t.push_back(c);
      d = std::max(c, d);
    }
    for (char c='a'; c<d+2; c++) {
      ret.push_back(s + c);
    }
  }

  return ret;
}

int main() {
  int N;
  std::cin >> N;

  for (auto const& s : solv(N)) {
    std::cout << s << '\n';
  }

  return 0;
}
