#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
const long long inf64 = 1e18;
const long long MOD = inf + 7;
vector<string> v;
vector<string> get(long long n, long long pos) {
  vector<string> aa;
  string ans = "";
  if (pos == n + 1) {
    aa.push_back(ans);
    return aa;
  }
  for (long long i = 1; i <= pos; i++) {
    for (auto s : get(n, pos + 1)) {
      string ans = to_string(i) + s;
      aa.push_back(ans);
    }
  }
  return aa;
}
int32_t main() {
  ios::sync_with_stdio(false), cin.tie(nullptr);
  ;
  long long n;
  cin >> n;
  auto v = get(n, 1);
  sort((v).begin(), (v).end());
  for (long long i = 0; i < (long long)(v).size(); i++) {
    for (auto c : v[i]) {
      cout << char(c - '1' + 'a');
    }
    cout << "\n";
  }
}
