#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

struct Memo {
	int fact = 0;
	int fact_inv = 0;
	int inv = 0;
};
class Combination {
private:
	int m_module = 1000000007;
	vector<struct Memo> memo;
public:
	int calculate(int, int);
	Combination(int, int);
};
int Combination::calculate(int n, int k) {
	return (memo[n].fact * memo[k].fact_inv * memo[n - k].fact_inv) % m_module;
}
Combination::Combination(int memo_max, int module = 1000000007) {
	m_module = module;
	memo.push_back({ 1,1,0 });
	memo.push_back({ 1,1,1 });
	for (int loop = 2; loop <= memo_max; loop++) {
		struct Memo temp;
		temp.fact = (memo[loop - 1].fact * loop) % m_module;
		temp.inv = m_module - memo[m_module % loop].inv * int(m_module / loop) % m_module;
		temp.fact_inv = (memo[loop - 1].fact_inv * temp.inv) % m_module;
		memo.push_back(temp);
	}
}

void A_Kth_Term(void) {

	int num[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	
	int K;
	cin >> K;

	cout << num[K - 1] << flush;
	return;
}

void B_Bishop(void) {

	long long H, W;
	cin >> H >> W;

	cout << (H == 1 || W == 1) ? 1 : int((H * W + 1) / 2) << flush;
	return;
}

void C_Sqrt_Inequality(void) {

	long long a, b, c;
	cin >> a >> b >> c;

	cout << ((a + b < c && (c - a - b) * (c - a - b) - 4 * a * b > 0) ? "Yes" : "No") << flush;
	return;
}

void generate(vector<int>& S, int flag) {

	S[flag]++;
	
	if (flag > 0 && S[flag] == S[flag - 1] + 2) {
		S[flag] = 0;
		generate(S, flag - 1);
	}
	return;
}
void D_String_Equivalence(void) {

	int N;
	cin >> N;

	vector<int> S(N);
	for (int& it : S) it = 0;
	for (S[0] == 0) {
		for (int it : S) cout << char((int)'a' + it);
		cout << endl;
		generate(S, N - 1);
	}
	return;
}

int main(void) {

	//A_Kth_Term();
	//B_Bishop();
	//C_Sqrt_Inequality();
	D_String_Equivalence();
	return 0;
}
