#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long mpow(long long a, long long b, long long p = MOD) {
  a = a % p;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % p;
    a = (a * a) % p;
    b = b >> 1;
  }
  return res % p;
}
const long long N = 5 * 1e5 + 5;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  vector<string> o;
  set<string> ans;
  string s = "";
  for (long long i = 0; i < n; i++) {
    s += 'a' + i;
  }
  o.push_back(s);
  ans.insert(s);
  for (long long i = n - 1; i >= 0; i--) {
    vector<string> oof;
    for (long long j = 0; j < n - 1; j++) {
      for (auto x : o) {
        string lol = "";
        for (long long k = 0; k < n; k++) {
          if (x[k] == 'a' + i + 1) {
            lol += 'a' + j;
          } else
            lol += x[k];
        }
        oof.push_back(lol);
      }
    }
    for (auto x : oof) ans.insert(x);
    o = oof;
  }
  for (auto x : ans) cout << x << "\n";
}
