#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
const double PI = acos(-1);
const int mod = 1e9 + 7;
const long long INF = (1LL << 60);
const int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll stringcount(string s, char c) { return count(s.cbegin(), s.cend(), c); }
bool isInteger(double x) { return floor(x) == x; }
ll ceil(ll a, ll b) { return ((a) + (b)-1) / b; }
template <class T>
inline bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
ll n;
string s = "";
vector<string> ans;
void dfs(string s) {
  ans.push_back(s);
  for (ll i = ((s).size()) - 1; i >= 1; i--) {
    if (s[i] - 'a' < n - 1) {
      string t = s;
      t[i]++;
      dfs(t);
    }
  }
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (ll i = ll(0); i < ll(n); i++) s += 'a';
  dfs(s);
  sort((ans).begin(), (ans).end());
  ans.erase(unique(ans.begin(), ans.end()), ans.end());
  for (auto u : ans) cout << u << endl;
  return 0;
}
