#include <bits/stdc++.h>
using namespace std;
template <typename S, typename T>
ostream& operator<<(ostream& out, const pair<S, T> p) {
  out << "(" << p.first << "," << p.second << ")";
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  for (auto a : v) out << a << " ";
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, const set<T>& S) {
  for (auto a : S) cout << a << " ";
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, const multiset<T>& S) {
  for (auto a : S) cout << a << " ";
  return out;
}
template <typename S, typename T>
ostream& operator<<(ostream& out, const map<S, T>& M) {
  for (auto m : M) cout << "(" << m.first << "->" << m.second << ") ";
  return out;
}
template <typename S, typename T>
pair<S, T> operator+(pair<S, T> a, pair<S, T> b) {
  return make_pair(a.first + b.first, a.second + b.second);
}
template <typename S, typename T>
pair<S, T> operator-(pair<S, T> a, pair<S, T> b) {
  return make_pair(a.first - b.first, a.second - b.second);
}
void backtrack(int n, int cur, string& val, vector<string>& A) {
  if (cur == n) {
    A.push_back(val);
    return;
  }
  if (cur == 0) {
    val.push_back('a');
    backtrack(n, cur + 1, val, A);
    val.pop_back();
  } else {
    int max_pre = -1;
    for (auto ch : val) {
      int pre = ch - 'a';
      max_pre = max(max_pre, pre);
    }
    for (int i = 0; i < 26 && i <= max_pre + 1; i++) {
      char ch = 'a' + i;
      if (ch >= val.back()) {
        val.push_back(ch);
        backtrack(n, cur + 1, val, A);
        val.pop_back();
      }
    }
  }
}
vector<string> solve(int n) {
  string val;
  vector<string> A;
  backtrack(n, 0, val, A);
  return A;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<string> A = solve(n);
  for (auto a : A) cout << a << endl;
  return 0;
}
