#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
void print() {}
template <class H, class... T>
void print(H&& h, T&&... t) {
  cout << h << " \n"[sizeof...(t) == 0];
  print(forward<T>(t)...);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  vector<string> ans;
  for (ll p = (0); p < (N); p++) {
    if (p == 0) {
      ans.push_back(string(N, 'a'));
    } else {
      vector<ll> a(N - 1, 1);
      for (ll i = (0); i < (p); i++) {
        a[i] = 0;
      }
      do {
        char cur = 'a';
        string res = "";
        res += cur;
        for (ll i = (0); i < (N - 1); i++) {
          if (a[i] == 0) {
            cur++;
          }
          res += cur;
        }
        ans.push_back(res);
      } while (next_permutation(a.begin(), a.end()));
    }
  }
  sort(ans.begin(), ans.end());
  for (auto& e : ans) print(e);
}
