#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long LINF = 1LL << 60;
const int INF = 1 << 30;
int main() {
  int n;
  cin >> n;
  vector<vector<string>> v(n + 2);
  v[1].push_back("a");
  for (int i = 2; i <= n; i++) {
    for (int j = 0; j < v[i - 1].size(); j++) {
      for (int k = 0; k <= (v[i - 1][j][v[i - 1][j].size() - 1] - 'a' + 1);
           k++) {
        v[i].push_back(v[i - 1][j] + (char)('a' + k));
      }
    }
  }
  sort(v[n].begin(), v[n].end());
  for (int i = 0; i < v[n].size(); i++) {
    cout << v[n][i] << endl;
  }
  return 0;
}
