#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
vector<char> cs;
void solve(string &s, int pos, int kinds, const int N) {
  if (pos == N) {
    cout << s << endl;
    return;
  }
  for (int i = 0; i < pos; i++) {
    char c = cs[i];
    if (c >= 'a' + (kinds + 1)) continue;
    s.push_back(c);
    int next_kind = kinds;
    solve(s, pos + 1, next_kind, N);
    s.pop_back();
  }
  if (pos == kinds) {
    s.push_back(cs[pos]);
    solve(s, pos + 1, kinds + 1, N);
    s.pop_back();
  }
}
int main(void) {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cs.push_back('a' + i);
  }
  string str = "";
  solve(str, 0, 0, N);
  return 0;
}
