#include <bits/stdc++.h>
#pragma gcc target("avx2")
#pragma gcc optimization("o3")
#pragma gcc optimization("unroll-loops")
using ll = long long;
constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acos(-1.0L);
using namespace std;
void scans(string& str) {
  char c;
  str = "";
  scanf("%c", &c);
  if (c == '\n') scanf("%c", &c);
  while (c != '\n' && c != -1 && c != ' ') {
    str += c;
    scanf("%c", &c);
  }
}
void scanc(char& str) {
  char c;
  scanf("%c", &c);
  if (c == -1) return;
  while (c == '\n') {
    scanf("%c", &c);
  }
  str = c;
}
double acot(double x) { return PI / 2 - atan(x); }
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll lcm(ll number1, ll number2) {
  return number1 / gcd(number1, number2) * number2;
}
ll LSB(ll n) { return (n & (-n)); }
int main() {
  int n;
  scanf("%d", &n);
  vector<string> ans;
  string tmp;
  for (int i = 0; i < (n); ++i) {
    for (int j = 0; j < (n - i); ++j) {
      tmp.push_back('a' + i);
    }
  }
  do {
    ans.push_back(tmp.substr(0, n));
  } while (next_permutation((tmp).begin(), (tmp).end()));
  for (auto& aa : ans) sort((aa).begin(), (aa).end());
  sort((ans).begin(), (ans).end());
  ans.erase(unique((ans).begin(), (ans).end()), ans.end());
  for (const auto& aa : ans) printf("%s\n", aa.c_str());
  return 0;
}
