#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
vector<string> ans;
void dfs(vector<long long> used, vector<long long> res, long long now = 0) {
  if (used.size() == 0) {
    string s;
    for (long long i = (0); i < ((res.size())); ++i) s += (char)(res[i] + 'a');
    ans.push_back(s);
    return;
  }
  res[used.back()] = now;
  used.pop_back();
  for (long long i = (0); i < ((1 << used.size())); ++i) {
    vector<long long> cur;
    vector<long long> res2 = res;
    for (long long j = (0); j < ((used.size())); ++j) {
      if ((i & (1LL << j)))
        res2[j] = now;
      else
        cur.push_back(used[j]);
    }
    dfs(cur, res2, now + 1);
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> tmp(n);
  iota(tmp.begin(), tmp.end(), 0);
  reverse(tmp.begin(), tmp.end());
  dfs(tmp, vector<long long>(n, 0));
  sort(ans.begin(), ans.end());
  for (long long i = (0); i < ((ans.size())); ++i) cout << ans[i] << endl;
  return 0;
}
