#include <bits/stdc++.h>
using namespace std;
int n;
vector<string> v;
void Rec(int i, string s) {
  if (i == n) {
    v.push_back(s);
    return;
  }
  for (char j = (s == "" ? 'a' : s.back());
       j <= min(char('a' + n), s == "" ? 'a' : char(s.back() + 1)); j++)
    Rec(i + 1, s + j);
}
int main() {
  cin >> n;
  Rec(0, "");
  for (auto j : v) cout << j << '\n';
  return 0;
}
