#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353.;
const int N = 1e6 + 5;
bool sortbysec(const pair<pair<long long, long long>, long long> &a,
               const pair<pair<long long, long long>, long long> &b) {
  return (a.second > b.second);
}
long long powermod(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
bool isprime(int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  string s;
  for (long long i = 0; i < n; i++) s += 'a';
  long long p = 0;
  long long k = n - 1;
  cout << s << "\n";
  while (1) {
    p = 0;
    for (long long i = k; i < n; i++, p++) s[i] = 'b' + p;
    string w = s;
    while (1) {
      cout << w << "\n";
      next_permutation(w.begin(), w.end());
      if (w == s) break;
    }
    k--;
    if (k == 0) break;
  }
  return 0;
}
