#include <bits/stdc++.h>
using namespace std;
const long long LINF = 1e18;
const int INF = 1e9;
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
using Graph = vector<vector<long long>>;
const long long MOD = 1000000007;
string tmp = "";
vector<string> ans;
void pri(string s, int max, int poi, int ch) {
  string tmpp = s;
  if (poi == max) {
    ans.push_back(tmpp);
  } else
    for (int i = 0; i <= ch + 1; i++) {
      tmpp[poi] = (char)('a' + i);
      pri(tmpp, max, poi + 1, i);
    }
}
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    tmp.push_back('a');
  }
  pri(tmp, n, 1, 0);
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << endl;
  }
  return 0;
}
