#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using D = long double;
using P = pair<ll, ll>;
vector<string> v;
int n;
void dfs(int i, int m, string s) {
  if (i == n) {
    v.emplace_back(s);
  }
  int c[10] = {};
  for (auto &e : s) {
    c[(int)(e - 'a')]++;
  }
  int cnt = 0;
  for (int j = 0; j < m; j++) {
    if (c[j] == 0) {
      cnt++;
    }
  }
  if (cnt > n - i) return;
  for (int j = 0; j < m; j++) {
    string t = s + (char)('a' + j);
    dfs(i + 1, m, t);
    if (c[j] == 0) break;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    dfs(0, i, "");
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) {
    cout << v[i] << '\n';
  }
}
