#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

long long mod = 1000000000 + 7;

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

vector<int> maxcount = vector<int>(10);

void solv_(int n, vector<int> ls,int target,int  now_max,int  index) {
	if (n == target){
		for (int i = 0;i < ls.size;i ++) {
			cout << char(97 + ls[i]);
		}
		cout << ('\n');
		return;
	}
		//kosu := len(ls)
	for (int i= 0; i < now_max + 2; i++) {
		ls[index] = i;
		now_max = max(now_max, i);
		maxcount[i] ++;
			//fmt.Println(ls)
		solv_(n + 1, ls, target, now_max, index + 1);
		maxcount[ls[index]] --;
			if (maxcount[now_max] == 0) {
				now_max--;
			}
		//ls = ls[0:len(ls) - 1]
	}
}

int main() {
	maxcount[0] = 1;
	int n;
	cin >> n;
	vector<int> ls = vector<int>(n);
	ls[0] = 1;
		solv_(1, ls, n, 0, 1);
}