#include <bits/stdc++.h>
using namespace std;
vector<string> v;
vector<int> bi;
int pa;
string tmp;
void bitgen(int n) {
  if (n == 0) {
    tmp = "";
    for (int i = pa - 1; i >= 0; i--) tmp += (char)('a' + bi[i]);
    v.emplace_back(tmp);
    return;
  }
  for (int i = 0; i <= bi[n] + 1; i++) {
    bi[n - 1] = i;
    bitgen(n - 1);
  }
}
int main() {
  int n;
  cin >> n;
  pa = n;
  bi.resize(n + 1, -1);
  bitgen(n);
  for (int i = 0; i < v.size(); i++) {
    cout << v[i] << endl;
  }
}
