#include <bits/stdc++.h>
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
using namespace std;
vector<string> S;
void rec(int k, int n, string now) {
  if (k == n)
    S.push_back(now);
  else {
    for (char c = 'a'; c <= now.back() + 1; c++) {
      rec(k + 1, n, now + c);
    }
  }
}
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string s = "a";
  rec(1, n, s);
  for (string t : S) cout << t << "\n";
  return 0;
}
