#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;
char output[11];
int bit[11] = {};
int n;
set<string> s;
void aux(int i) {
  if (i == 1) {
    int bit_done = 0;
    char c = 'a';
    for (int j = 0; j < n; j++) {
      if (bit_done & (1 << j)) {
        continue;
      }
      output[j] = c;
      for (int k = j + 1; k < n; k++) {
        if (bit_done & (1 << k)) {
          continue;
        }
        if (bit[j] & (1 << (n - k - 1))) {
          bit_done |= 1 << k;
          output[k] = c;
        }
      }
      c++;
    }
    string str(output, n);
    s.insert(str);
  } else {
    for (bit[n - i] = 0; bit[n - i] < (1 << (i - 1)); ++bit[n - i]) {
      aux(i - 1);
    }
  }
}
void solve(int n) { aux(n); }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  output[n] = '\0';
  solve(n);
  for (auto e : s) {
    cout << e << "\n";
  }
}
