#include <bits/stdc++.h>
using namespace std;
template <class T>
using VV = vector<vector<T>>;
template <class T>
inline T SMIN(T& a, const T b) {
  return a = (a > b) ? b : a;
}
template <class T>
inline T SMAX(T& a, const T b) {
  return a = (a < b) ? b : a;
}
template <class Iter>
void __kumaerrc(Iter begin, Iter end) {
  for (; begin != end; ++begin) {
    cerr << *begin << ',';
  }
  cerr << endl;
}
void __kumaerr(istream_iterator<string> it) {
  (void)it;
  cerr << endl;
}
template <typename T, typename... Args>
void __kumaerr(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << "=" << a << ", ", __kumaerr(++it, args...);
}
template <typename S, typename T>
std::ostream& operator<<(std::ostream& _os, const std::pair<S, T>& _p) {
  return _os << "{" << _p.first << ',' << _p.second << "}";
}
int N;
vector<string> res;
void dfs(int cur, string& s) {
  int L = int((s).size());
  if (L == N) {
    res.push_back(s);
    return;
  }
  for (int i = 0; i <= (cur); ++i) {
    char c = 'a' + i;
    s.push_back(c);
    dfs(i + 1, s);
    s.pop_back();
  }
}
void solve() {
  string s;
  dfs(0, s);
  for (int i = 0; i < (int((res).size())); ++i) cout << res[i] << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(12) << fixed;
  cin >> N;
  solve();
  return 0;
}
