#include <bits/stdc++.h>
using namespace std;
vector<string> results;
int n;
void rec(string s) {
  map<char, int> m;
  for (int i = 0; i < (s.size()); i++) m[s[i]]++;
  for (int i = 0; i < (m.size() + 1); i++) {
    char c = (char)('a' + i);
    string t(s);
    t.push_back(c);
    if (t.size() == n)
      results.push_back(t);
    else
      rec(t);
  }
}
int main() {
  cin >> n;
  rec("a");
  for (int i = 0; i < (results.size()); i++) cout << results[i] << endl;
  return 0;
}
