#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
set<string> expand(string s) {
  set<char> k = set<char>();
  for (char c : s) {
    k.insert(c);
  }
  vector<char> chars = vector<char>();
  for (char c : k) {
    chars.push_back(c);
  }
  sort(chars.begin(), chars.end());
  set<string> new_s = set<string>();
  for (int i = 0; i < chars.size(); i++) {
    int j = i;
    while (s[j] < chars[i]) {
      j += 1;
    }
    while (j < s.size() + 1) {
      string new_string = s.substr(0, j) + chars[i] + s.substr(j);
      new_s.insert(new_string);
      j += 1;
    }
  }
  string new_string = s + char(int(chars[chars.size() - 1]) + 1);
  new_s.insert(new_string);
  return new_s;
}
set<string> solve(int N) {
  set<string> ans = set<string>();
  if (N == 1) {
    return set<string>({"a"});
  } else {
    set<string> p = solve(N - 1);
    for (string s : p) {
      set<string> k = expand(s);
      set_union(k.begin(), k.end(), ans.begin(), ans.end(),
                inserter(ans, ans.end()));
    }
    return ans;
  }
}
int main() {
  int N;
  cin >> N;
  set<string> ans = solve(N);
  vector<string> ans_v = vector<string>(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) {
    cout << ans_v[i] << endl;
  }
  return 0;
}
