#include <bits/stdc++.h>
using namespace std;
set<string> kk;
long long int ok(string s) {
  long long int f = 0;
  for (long long int i = 0; i < (long long int)s.size(); i++) {
    if (s[i] > i + 97) f = 1;
  }
  for (long long int i = 0; i < (long long int)s.size() - 1; i++) {
    if (s[i] + 1 < s[i + 1]) f = 1;
  }
  return (!f);
}
vector<string> build_string(long long int n) {
  if (n == 1) {
    vector<string> vv;
    vv.push_back("a");
    return vv;
  }
  string t = "";
  vector<string> vv;
  for (long long int i = 0; i < n; i++) {
    vector<string> v = build_string(n - 1);
    for (long long int j = 0; j < v.size(); j++) {
      string pika = "";
      pika.push_back(i + 97);
      t = v[j] + pika;
      vv.push_back(t);
    }
  }
  return vv;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  long long int ans = 0;
  vector<string> v = build_string(n);
  for (long long int i = 0; i < (long long int)v.size(); i++) {
    if (ok(v[i])) cout << v[i] << "\n";
  }
}
