#include <bits/stdc++.h>
using namespace std;
void solve();
long long pow(long long a, long long b, long long m) {
  long long ans = 1;
  while (b > 0) {
    if (b % 2 == 1) ans = (ans * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return ans % m;
}
long long InverseMod(long long a, long long m) { return pow(a, m - 2, m); }
long long add(long long a, long long b, long long mod) {
  long long c = (a + b);
  if (c >= mod) {
    c -= mod;
  }
  return c;
}
long long sub(long long a, long long b, long long mod) {
  long long c = (a - b);
  if (c < 0) {
    c += mod;
  }
  return c;
}
long long mul(long long a, long long b, long long mod) {
  long long c = (a * b) % mod;
  return c;
}
long long div(long long a, long long b, long long mod) {
  long long c = mul(a, InverseMod(b, mod), mod);
  return c;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  for (long long i = 1; i <= t; ++i) solve();
  cerr << "Time taken: " << ((clock() * 1000) / CLOCKS_PER_SEC) << "ms\n";
}
std::vector<string> v;
long long n;
void f(long long x) {
  string ans = "";
  for (long long i = 0; i < x; ++i) {
    ans.push_back((char)(i + 'a'));
  }
  map<string, long long> mp;
  queue<string> q;
  q.push(ans);
  mp[ans] = 1;
  while (((long long)q.size())) {
    string top = q.front();
    q.pop();
    if (((long long)top.size()) == n) {
      v.push_back(top);
      continue;
    }
    for (long long i = 0; i < x; ++i) {
      top.push_back((char)(i + 'a'));
      if (mp[top] == 0) {
        q.push(top);
        mp[top] = 1;
      }
      top.pop_back();
    }
  }
}
void solve() {
  cin >> n;
  for (long long i = 1; i < n + 1; ++i) {
    f(i);
  }
  sort(v.begin(), v.end());
  for (auto i : v) {
    cout << i << '\n';
  }
}
