#include <bits/stdc++.h>
using namespace std;
int N;
vector<string> sv;
void f(string a, int len, int m) {
  string rs;
  for (int i = 0; i < (m + 1); ++i) {
    rs = a;
    if (len < N) {
      rs += ('a' + i);
      f(rs, len + 1, i + 1);
    } else {
      sv.push_back(rs);
      return;
    }
  }
  return;
}
int main() {
  cin >> N;
  string s;
  s = "a";
  f(s, 1, 1);
  sort(sv.begin(), sv.end());
  for (auto a : sv) cout << a << endl;
}
