#include <bits/stdc++.h>
using namespace std;
class DStringEquivalence {
 public:
  long long N;
  void dfs(vector<string>& res, string cur, long long d) {
    if (d == N) {
      res.push_back(cur);
      return;
    }
    for (long long i = 0, i_len = (d + 1); i < i_len; ++i) {
      char c = i + 'a';
      dfs(res, cur + c, d + 1);
    }
  }
  void solve(std::istream& cin, std::ostream& cout) {
    cin >> N;
    vector<string> res;
    dfs(res, "", 0);
    sort(res.begin(), res.end());
    for (long long i = 0, i_len = (res.size()); i < i_len; ++i)
      cout << res[i] << endl;
  }
};
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  DStringEquivalence solver;
  solver.solve(in, out);
  return 0;
}
