#include <bits/stdc++.h>
using namespace std;
vector<string> ans;
void solve(int i, int n, string acc) {
  if (i == n) {
    ans.push_back(acc);
    return;
  }
  int prev = acc[acc.size() - 1] - 'a' + 2;
  int m = max(prev, i);
  for (int j = 0; j < (int)(m); j++) {
    solve(i + 1, n, acc + (char)('a' + j));
  }
}
int main() {
  int n;
  cin >> n;
  solve(1, n, "a");
  for (auto x : ans) {
    cout << x << endl;
  }
}
