#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

int main(){
    std::ios::sync_with_stdio(false);
    vector<ll> v[11];

    v[1].push_back(0ll);

    for(int i=1;i<=9;++i)
    {
        for(int tmp: v[i])
        {
            int last_digit = tmp % 10;
            for(int j=0;j<=last_digit+1;++j)
            {
                v[i+1].push_back(tmp * 10 + j);
            }
        }
    }
    int n;
    cin >> n;

    for(int x: v[n])
    {
        char c[n+1] = {};
        for(int i=0;i<n;++i)
        {
            c[i] = x % 10 +'a';
            x /= 10;
        }
        string s(c);
        reverse(s.begin(), s.end());
        cout << s << endl;
    }
}