#include <bits/stdc++.h>
using ll = long long;
using namespace std;
void dfs(vector<int> &check, int depth, int max_i, int n, vector<string> &ans,
         string t) {
  if (depth > n - 1) {
    ans.push_back(t);
    return;
  }
  for (int i = 0; i < min(10, max_i + 1); i++) {
    check[i]++;
    dfs(check, depth + 1, min(10, max(max_i + 1, i)), n, ans,
        t + (char)(i + 'a'));
    check[i]--;
  }
}
int main() {
  int n;
  cin >> n;
  vector<string> ans;
  vector<int> check(26, 0);
  check[0] = 1;
  dfs(check, 1, 1, n, ans, "a");
  sort(ans.begin(), ans.end());
  for (auto i : ans) {
    cout << i << endl;
  }
}
