#include <bits/stdc++.h>
using namespace std;
vector<string> ans;
int n;
void fans(string s) {
  if (s.length() == n) {
    ans.push_back(s);
    return;
  }
  for (int i = 0; i <= s.back() - 'a' + 1; i++) {
    s.push_back('a' + i);
    fans(s);
    s.pop_back();
  }
  return;
}
int main() {
  cin >> n;
  string s = "a";
  fans(s);
  sort(ans.begin(), ans.end());
  for (auto it : ans) cout << it << "\n";
}
