#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF * INF * 10;
int n;
vvi s;
void dfs(int i, int j) {
  if (i == n) return;
  s[j][i] = s[j][i - 1];
  vi a = s[j];
  int x = 0;
  while (x != 2) {
    dfs(i + 1, j);
    a[i]++;
    if (a[i] == n || x == 1) break;
    s.push_back(a);
    j = s.size() - 1;
    x++;
  }
}
int main() {
  cin >> n;
  vi a(n);
  s.push_back(a);
  dfs(1, 0);
  vs xx(s.size());
  for (int i = 0; i < s.size(); ++i) {
    for (int j = 0; j < n; ++j) {
      if (j && s[i][j] < s[i][j - 1]) s[i][j] = s[i][j - 1];
      xx[i].push_back(s[i][j] + 'a');
    }
  }
  sort(xx.begin(), xx.end());
  for (int i = 0; i < s.size(); ++i) {
    cout << xx[i] << '\n';
  }
}
