#include <bits/stdc++.h>
using namespace std;
vector<int> bi;
int pa;
void bitgen(int n) {
  if (n == 0) {
    for (int i = bi.size() - 1; i >= 0; i--) cout << (char)('a' + bi[i]);
    cout << endl;
    return;
  }
  for (int i = 0; i <= bi[n] + 1; i++) {
    bi[n - 1] = i;
    bitgen(n - 1);
    if (n == pa) break;
  }
}
int main() {
  int n;
  cin >> n;
  pa = n;
  bi.resize(n, 0);
  bitgen(n);
}
