#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long power(long long a, long long b, long long m = mod) {
  long long x = 1;
  while (b) {
    if (b & 1) {
      x = 1ll * x * a % m;
    }
    a = 1ll * a * a % m;
    b /= 2;
  }
  return x;
}
const int N = 2e5 + 9;
vector<vector<char>> norms;
vector<char> cur;
int n;
int uniq;
void solve(int ind) {
  if (ind == n) {
    norms.push_back(cur);
    return;
  }
  for (int i = 0; i < ind; i++) {
    cur.push_back(cur[i]);
    solve(ind + 1);
    cur.pop_back();
  }
  cur.push_back('a' + uniq);
  uniq++;
  solve(ind + 1);
  uniq--;
  cur.pop_back();
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  cur.push_back('a');
  uniq = 1;
  solve(1);
  sort(norms.begin(), norms.end());
  for (auto it : norms) {
    cout << string(it.begin(), it.end()) << "\n";
  }
  return 0;
}
