#include <bits/stdc++.h>
using namespace std;
int64_t INF = 1e18;
int inf = 1e9;
int64_t mod = 1e9 + 7;
int64_t n;
vector<string> res;
void rec(string s, int64_t x) {
  if (x == n) {
    res.push_back(s);
    return;
  }
  for (int64_t i = 0; i <= s.back() - 'a' + 1; i++) {
    char c = 'a';
    s += (c + i);
    rec(s, x + 1);
    s.pop_back();
  }
}
int main() {
  cin >> n;
  vector<int64_t> v;
  rec("a", 1);
  sort((res).begin(), (res).end());
  for (int64_t i = 0; i < (int64_t)res.size(); i++) {
    cout << (res[i]) << '\n';
  }
  return 0;
}
