#include <bits/stdc++.h>
using namespace std;
double pi = 2 * acos(0.0);
int n;
vector<vector<char> > c;
vector<char> ans;
void back_track(int in, char prev) {
  if (in == n) {
    c.push_back(ans);
    return;
  }
  for (int i = 0; i <= prev - 'a' + 1; i++) {
    ans[in] = char(i + 'a');
    back_track(in + 1, ans[in]);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  ans.assign(n, 'a');
  back_track(1, 'a');
  sort(c.begin(), c.end());
  for (int i = 0; i < c.size(); i++) {
    for (int j = 0; j < n; j++) {
      cout << c[i][j];
    }
    cout << "\n";
  }
  return 0;
}
