#include <bits/stdc++.h>
using namespace std;
const long long LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
template <typename T>
T gcd(T a, T b) {
  return (a == 0) ? b : gcd(b % a, a);
}
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
bool p_comp_fs(const pair<long long, long long> p1,
               const pair<long long, long long> p2) {
  return p1.first < p2.first;
};
bool p_comp_fg(const pair<long long, long long> p1,
               const pair<long long, long long> p2) {
  return p1.first > p2.first;
};
bool p_comp_ss(const pair<long long, long long> p1,
               const pair<long long, long long> p2) {
  return p1.second < p2.second;
};
bool p_comp_sg(const pair<long long, long long> p1,
               const pair<long long, long long> p2) {
  return p1.second > p2.second;
};
template <typename T>
vector<T> uniquen(vector<T> vec) {
  sort((vec).begin(), (vec).end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;
}
inline long long popcnt(long long x) {
  return __builtin_popcountll((unsigned long long)x);
};
template <class T>
bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
bool bit(long long st, long long b) { return ((st >> b) & 1) == 1; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long N;
  cin >> N;
  vector<vector<long long> > v;
  for (long long i = 0; i < N; i++) {
    vector<vector<long long> > vswap;
    if (i == 0) {
      vswap.push_back({0});
    } else {
      for (vector<long long>& vin : v) {
        vector<long long> vcpy = vin;
        for (long long k = 0; k < i + 1; k++) {
          if (k > vcpy.back() + 1) break;
          vector<long long> vtmp = vcpy;
          vtmp.push_back(k);
          vswap.push_back(vtmp);
        }
      }
    }
    swap(vswap, v);
  }
  vector<string> ans;
  for (auto& vin : v) {
    string S = "";
    for (long long idx : vin) {
      S += char('a' + idx);
    }
    ans.push_back(S);
  }
  sort((ans).begin(), (ans).end());
  for (auto& s : ans) {
    cout << s << endstr;
  }
  return 0;
}
