#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  queue<pair<string, int>> table;
  table.push({"a", 1});
  if (N == 1) {
    cout << 'a' << endl;
  } else {
    for (int i = 1; i < N; i++) {
      while (true) {
        pair<string, int> t = table.front();
        if (t.first.length() == i) {
          table.pop();
          string s = t.first;
          int count = t.second;
          for (int j = 0; j < count + 1; j++) {
            table.push({s + (char)('a' + j), min(count + j, j + 1)});
          }
        } else {
          break;
        }
      }
    }
    while (!table.empty()) {
      pair<string, int> t = table.front();
      table.pop();
      cout << t.first << endl;
    }
  }
}
