#include <bits/stdc++.h>
using namespace std;
map<string, long long> mp;
long long arr[666666];
string ans[666666];
signed main() {
  long long res = 0;
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) arr[i] = 1;
  for (long long i = 1; i <= n; i++) {
    sort(arr + 1, arr + 1 + n);
    arr[1] = i;
    sort(arr + 1, arr + 1 + n);
    do {
      long long cnt = 1;
      map<long long, long long> vis;
      string str = "";
      for (long long j = 1; j <= n; j++) {
        if (!vis[arr[j]]) {
          vis[arr[j]] = cnt;
          str = str + (char)('a' + (vis[arr[j]] - 1));
          cnt++;
        } else {
          str = str + (char)('a' + (vis[arr[j]] - 1));
        }
      }
      if (!mp[str]) ans[res++] = str;
      mp[str] = 1;
    } while (next_permutation(arr + 1, arr + 1 + n));
  }
  sort(ans, ans + res);
  for (long long i = 0; i < res; i++) cout << ans[i] << '\n';
  return 0;
}
