#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int in() {
  int x;
  cin >> x;
  return x;
}
long long lin() {
  long long x;
  cin >> x;
  return x;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline void print(pair<T, T> p) {
  cout << "(" << p.first << "," << p.second << ") ";
}
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x;
  return is;
}
const long long INF = 1e9 + 7;
long long n;
vector<string> v;
char c[10] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'};
void dfs(string s, long long pos) {
  if (s.length() == n) {
    v.push_back(s);
    return;
  }
  dfs(s + c[pos], pos);
  pos++;
  dfs(s + c[pos], pos);
}
int main() {
  cin >> n;
  set<string> ans;
  string u = "";
  dfs(u, 0);
  sort(v.begin(), v.end());
  for (long long i = 0; i < n; i++) {
    string r = v[i];
    do {
      ans.insert(r);
    } while (next_permutation(r.begin(), r.end()));
  }
  long long m = ans.size();
  for (auto x : ans) {
    if (x[0] != 'a') break;
    cout << x << endl;
  }
  return 0;
}
