#include <bits/stdc++.h>
using namespace std;
const long long linf = 1001002003004005006ll;
const int inf = 1001001001;
const int mod = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  queue<string> que;
  int cnt = 0;
  string l;
  for (char i = 'a'; i <= 'j'; ++i) {
    l += i;
    cnt++;
    if (cnt == n) break;
  }
  que.push(l);
  set<string> st;
  st.insert(l);
  while (que.size()) {
    string tmp = que.front();
    que.pop();
    for (int i = 0; i < (n - 1); ++i) {
      for (int j = i + 1; j < n; ++j) {
        if (tmp[i] == tmp[j]) continue;
        char c = tmp[j];
        tmp[j] = tmp[i];
        que.push(tmp);
        st.insert(tmp);
        tmp[j] = c;
      }
    }
  }
  for (string c : st) cout << c << endl;
  return 0;
}
