#include <bits/stdc++.h>
using namespace std;
inline void normal(long long &a) {
  a %= 1000000007;
  (a < 0) && (a += 1000000007);
}
inline long long modMul(long long a, long long b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  return (a * b) % 1000000007;
}
inline long long modAdd(long long a, long long b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  return (a + b) % 1000000007;
}
inline long long modSub(long long a, long long b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  a -= b;
  normal(a);
  return a;
}
inline long long modPow(long long b, long long p) {
  long long r = 1;
  while (p) {
    if (p & 1) r = modMul(r, b);
    b = modMul(b, b);
    p >>= 1;
  }
  return r;
}
inline long long modInverse(long long a) { return modPow(a, 1000000007 - 2); }
inline long long modDiv(long long a, long long b) {
  return modMul(a, modInverse(b));
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
int main() {
  int n;
  cin >> n;
  vector<char> a = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'};
  string s = "", t = "";
  for (int i = 0; i < (int)(n); i++) {
    s.push_back('a');
  }
  vector<string> b;
  b.push_back(s);
  for (int i = 1; i < s.size(); ++i) {
    while (s[i] < 97 + i) {
      s[i]++;
      b.push_back(s);
      for (int j = 1; j < s.size() - 1; ++j) {
        if (s[j] > s[j + 1]) {
          swap(s[j], s[j + 1]);
          b.push_back(s);
        }
      }
    }
  }
  sort((b).begin(), (b).end());
  for (int i = 0; i < (int)(b.size()); i++) {
    cout << b[i] << endl;
  }
}
