#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const long long INF = 1LL << 60;
const long long mod = (int)1e9 + 7;
int main() {
  int n;
  cin >> n;
  string s = "";
  for (int i = 0; i < n; i++) s.push_back('a');
  for (int i = 0; i < pow(n, n); i++) {
    int mx = -1;
    vector<int> v;
    int now = i;
    for (int j = 0; j < n; j++) {
      v.push_back(now % n);
      now /= n;
    }
    reverse((v).begin(), (v).end());
    bool can = true;
    for (int i = 0; i < n; i++) {
      if (v[i] == mx + 1)
        mx = v[i];
      else if (v[i] > mx)
        can = false;
    }
    if (can) {
      for (int j = 0; j < n; j++) {
        char c = 'a' + v[j];
        cout << c;
      }
      cout << endl;
    }
  }
}
