#include <bits/stdc++.h>
using namespace std;
const long long int N = 500010;
vector<string> ans;
void func2(string s) {
  long long int n = s.length();
  --n;
  vector<long long int> p(n);
  for (long long int i = 0; i < n; ++i) {
    p[i] = s[i + 1] - 'a';
  }
  do {
    string t = "a";
    for (long long int i = 0; i < n; ++i) {
      t += char('a' + p[i]);
    }
    ans.push_back(t);
  } while (next_permutation(p.begin(), p.end()));
}
void func(long long int n, string s) {
  if (n == 0) {
    func2(s);
    return;
  }
  long long int ii = s.length();
  s += s[ii - 1];
  func(n - 1, s);
  s.pop_back();
  s += (s[ii - 1] + 1);
  func(n - 1, s);
  s.pop_back();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  string s = "a";
  func(n - 1, s);
  sort(ans.begin(), ans.end());
  for (auto x : ans) {
    cout << x << endl;
  }
  return (0);
}
