#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<string> v;
  v.push_back("a");
  vector<int> mx;
  mx.push_back(0);
  for (int i = 1; i < n; i++) {
    vector<string> new_v;
    vector<int> new_mx;
    for (int j = 0; j < (int)v.size(); j++) {
      string s = v[j];
      char c = s[(int)s.size() - 1];
      for (int jj = 0; jj <= min(25, mx[j] + 1); jj++) {
        string t = s + (char)(jj + 'a');
        new_v.push_back(t);
        new_mx.push_back(max(mx[i], jj));
      }
    }
    swap(v, new_v);
    swap(mx, new_mx);
  }
  sort(v.begin(), v.end());
  for (auto& s : v) {
    cout << s << '\n';
  }
  return 0;
}
