#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
const ll MOD = 1000000007;
int n;
map<string, string> m;
string to_key(string s) {
  string ret = "";
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (s[i] == s[j]) {
        ret += "|" + to_string(i) + "," + to_string(j);
      }
    }
  }
  return ret;
}
void dfs(string s, int len) {
  if (len == n) {
    string k = to_key(s);
    if (m.find(k) == m.end()) {
      m.insert(make_pair(k, s));
    }
    return;
  }
  for (int i = 0; i < n; i++) dfs(s + string(1, ((char)'a' + i)), len + 1);
}
void solve() {
  cin >> n;
  dfs("", 0);
  vector<string> v;
  for (auto it = m.begin(); it != m.end(); it++) v.push_back(it->second);
  sort((v).begin(), (v).end());
  for (string vi : v) std::cout << (vi) << "\n";
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  cout << fixed << setprecision(12);
  solve();
}
