#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1LL << 60;
ll n, p;
string s;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  vector<string> ans;
  ++n;
  ans.push_back("");
  for (int i = 0; i < n - 1; ++i) {
    vector<string> tmp;
    for (auto a : ans) {
      for (int j = 0; j <= i; ++j) {
        tmp.push_back(a + (char)('a' + j));
      }
    }
    ans = tmp;
  }
  sort(ans.begin(), ans.end());
  for (auto a : ans) {
    string tmp = a;
    sort(tmp.begin(), tmp.end());
    tmp.erase(unique(tmp.begin(), tmp.end()), tmp.end());
    int sz = tmp.size();
    bool check = true;
    for (auto c : tmp) {
      if (c - 'a' >= sz) check = false;
    }
    if (check) cout << a << '\n';
  }
  return 0;
}
