#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
inline bool minimize(T1& a, T2 b) {
  return b < a && (a = b, 1);
}
template <class T1, class T2>
inline bool maximize(T1& a, T2 b) {
  return a < b && (a = b, 1);
}
template <class T, class V>
istream& operator>>(istream& ist, pair<T, V>& p) {
  return ist >> p.first >> p.second;
}
template <class T>
ostream& operator<<(ostream& ost, pair<T, T>& p) {
  return ost << p.first << ", " << p.second;
}
template <class T>
istream& operator>>(istream& ist, vector<T>& vs) {
  for (auto& e : vs) ist >> e;
  return ist;
}
int const inf = INT_MAX / 2;
int N;
vector<string> out;
void dfs(int curr, deque<char>& cs) {
  if (cs.size() == N) {
    string s;
    for (int i = 0; i < (int)cs.size(); i++) s.push_back(cs[i]);
    out.push_back(s);
    return;
  }
  for (int i = 0; i < (int)curr + 1; i++) {
    cs.push_back('a' + i);
    dfs(i + 1, cs);
    cs.pop_back();
  }
}
int main() {
  cin >> N;
  deque<char> cs;
  dfs(0, cs);
  for (int i = 0; i < (int)out.size(); i++) {
    cout << out[i] << "\n";
  }
}
