#include <bits/stdc++.h>
using namespace std;
vector<string> v;
void solve(string res, long long id, long long n) {
  if (id == n) {
    v.push_back(res);
    return;
  }
  for (long long i = 0; i < n; i++) {
    res += 'a' + i;
    solve(res, id + 1, n);
    res.pop_back();
  }
}
int32_t main() {
  long long n;
  cin >> n;
  solve("", 0, n);
  for (long long i = 0; i < n; i++) {
    cout << v[i] << '\n';
  }
}
