#include <bits/stdc++.h>
using namespace std;
class Task {
 private:
  int n;
  string str;

 public:
  Task(int n, string str) : n(n), str(str) {}
  void enTask(stack<Task*>* stack) {
    if (str.length() == n) {
      cout << str << endl;
      return;
    }
    for (char c = 'a' + n - 1; c >= 'a'; c--) {
      stack->push(new Task(n, str + c));
    }
  }
};
signed main() {
  int n;
  cin >> n;
  std::stack<Task*>* stack = new std::stack<Task*>();
  Task* firTask = new Task(n, "a");
  stack->push(firTask);
  while (!stack->empty()) {
    Task* task = stack->top();
    stack->pop();
    task->enTask(stack);
  }
}
