#include <bits/stdc++.h>
using namespace std;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
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;
}
const int INF = (long long)1e9;
const long long INFLL = (long long)1e18 + 1;
const long long MOD = (long long)1e9 + 7;
const double PI = acos(-1.0);
int N;
vector<int> x;
set<string> xx;
void dfs(int i, int s, int minn) {
  if (i == N) {
    map<char, int> mapx;
    map<char, char> mapy;
    string ss = to_string(s);
    string res = "";
    int cnt = 0;
    for (int j = 0; j < int(ss.size()); ++j) {
      if (mapx[ss[j]] == 0) {
        res.push_back(char(cnt + 'a'));
        mapy[ss[j]] = char(cnt + 'a');
        cnt++;
        mapx[ss[j]]++;
      } else {
        res.push_back(mapy[ss[j]]);
      }
    }
    xx.insert(res);
    x.push_back(s);
    return;
  }
  for (int nxt = minn; nxt <= N; nxt++) {
    int nxtmin = max(minn, nxt);
    int tmp = s * 10 + nxt;
    dfs(i + 1, tmp, nxtmin);
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  cin >> N;
  dfs(0, 0, 1);
  for (auto y : xx) {
    cout << y << endl;
  }
}
