#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v) {
  int sz = v.size();
  for (int i = 0; i < sz; i++) {
    cout << v[i] << " \n"[i == sz - 1];
  }
}

int n;
vector<string> ret;
void dfs(string s, char nxt = 'a') {
  if ((int)s.size() == n) {
    ret.push_back(s);
    return;
  }
  auto snxt = s + nxt;
  dfs(snxt, nxt + 1);
  for (auto c = 'a'; c < nxt; c++) {
    auto ssnxt = s + c;
    dfs(ssnxt, nxt);
  }
  return;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;
  dfs("");
  sort(ret.begin(),ret.end());
  for(auto s:ret) cout << ret << endl;
}
