#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  set<string> res;
  queue<string> que;
  que.push("a");
  while (!que.empty()) {
    string s = que.front();
    que.pop();
    if (s.size() == N) {
      res.insert(s);
      continue;
    }
    for (int i = 0; i <= s.back() - 'a' + 1; i++) que.push(s + (char)('a' + i));
  }
  for (auto s : res) {
    cout << s << endl;
  }
  return 0;
}
