#include <bits/stdc++.h>
using namespace std;
long long int n;
set<string> si;
void print_all(string &s, long long int in, long long int ch) {
  if (in == n)
    si.insert(s);
  else {
    for (long long int i = 0; i < ch + 1; ++i) {
      s[in] = 'a' + i;
      print_all(s, in + 1, ch);
    }
  }
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (long long int i = 0; i < n; ++i) {
    long long int j = i + 1;
    string s;
    s.resize(n);
    long long int l = 0;
    while (j) {
      s[l] = 'a' + l;
      j--;
      l++;
    }
    print_all(s, i + 1, i + 1);
  }
  for (auto e : si) cout << e << "\n";
  return 0;
}
