#include <bits/stdc++.h>
using namespace std;
const long long N = 10001;
long long power(long long i, long long j) {
  if (j == 0) return 1;
  long long t = power(i, j / 2) % 1000000007;
  if (j % 2 == 0)
    return (t % 1000000007 * t % 1000000007) % 1000000007;
  else
    return ((t % 1000000007 * t % 1000000007) % 1000000007 * (i % 1000000007) %
            1000000007) %
           1000000007;
}
long long n;
vector<string> ans;
void fun(long long i, long long j, string s) {
  if (i == n) {
    ans.push_back(s);
  } else {
    string ns = s;
    for (long long k = 0; k < j; k++) {
      ns = s;
      ns += (char)('a' + k);
      fun(i + 1, j, ns);
    }
    if (s.length() == 0) return;
    long long ops = s[s.length() - 1] - 'a';
    if (ops + 1 < 26) {
      ns = s;
      ns += (char)('a' + (ops + 1));
      fun(i + 1, max(ops + 1, j), ns);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long tests = 1;
  for (long long testcase = 1; testcase <= tests; testcase++) {
    cin >> n;
    fun(0, 1, "");
    sort(ans.begin(), ans.end());
    for (string s : ans) cout << s << endl;
  }
}
