#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define x first
#define y second
#define pb push_back
#define pf push_front
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

void solve()
{
	int n;
	cin >> n;
	int cnt = 1;
	vector<string> now;
	string s = "";
	rep(i, n) s.push_back('a');
	now.push_back(s);
	int ite[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
	while (cnt < n)
	{
		vector<string> next;

		rep(i, now.size())
		{
			rep(j, ite[cnt])
			{
				string t=now[i];
				t[cnt]+=j;
				next.push_back(t);
			}
		}
		now=next;
		cnt++;
	}
	map<string,int>used;
	vector<string>ans;
	rep(i,now.size()){
		char mc='a';
		rep(j,n){
			if(now[i][j]>mc){
				char prev=now[i][j];
				FOR(k,j+1,n){
					if(prev==now[i][k]){
						now[i][k]=mc+1;
					}
				}
			}
			mc++;
		}
		if(!used[now[i]]){
			ans.push_back(now[i]);
		}

	}
	rep(i,ans.size())cout<<ans[i]<<endl;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
}
