// Slower C++ solution:
#include	<bits/stdc++.h>

using	namespace	std;

typedef	long long ll;



// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)

// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)



// lower_bound(A.begin(), A.end(), N)

// upper_bound(...



// A.erase(unique(A.begin(), A.end()), A.end())



// bit: &/and, |/or, ^/xor, ~/not



// getline(cin, String)

// while (getline(cin, S)) {}



// #include <cstdio>

// int a;

// scanf("%d", &a);

// printf("%d\n", a);

//

// for (int i=0; i<n; ++i)

// 	scanf("%d", &a[i]);

//

// char c;

// scanf(" %c", &c);

//

// cout << "\n";



// cout <<fixed <<setprecision(10)



// priority_queue<int> q;

// priority_queue<int, vector<int>, less<int>> q; // Default: vector, less

// priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> q;



// Graph

// Warshall-Floyd: Distance between each node, N^3

// Dijkstra: Distance from the start node, N^2

// DFS(Depth-First Search)



//

// Notes

//

// When specified less than N, try full scan.

// RE: empty vector

// Check Qs

// long/int

// xor -> count each bit

// Check values

// 	1,000,000 -> Loop

// 	100,000	-> vector(int:400KB, long:800KB) 



#define	INF (1<<30)

//1,073,741,824

//= 536,870,912 *2



#define	MOD 1000000007



/*

ll	myPow(ll x, ll n) {

	if (0==n)

		return 1;

	if (0==n%2)

		return myPow(x*x%MOD, n/2);

	else

		return x*myPow(x, n-1)%MOD;

}

*/

ll	myPow(ll x, ll n) {

	ll r=1;

	while(n>0)

		if (0==n%2) {

			x *=x;

			x %=MOD;

			n /=2;

		} else {

			r *=x;

			r %=MOD;

			n--;

		}

	return r;

}



#define	Rep0(i, n)	for (int i=0; i<n; i++)

#define	Rep1(i, n)	for (int i=1; i<=n; i++)

#define Sort(P)	sort(P.begin(), P.end())

#define Rev(P)	reverse(P.begin(), P.end())

void	F(const string pre, const char c, const int n, vector<string> &S) {

	if (0==n) {

		S.push_back(pre);

		return;

	}

	string pre1=pre;

	for (int i=1; i<=n; i++) {

		pre1 +=c;

		F(pre1, c+1, n-i, S);

	}

	return;

}



void	FF(const string pre, const char c, const char d, const char maxc, const int n, vector<string> &S) {

	if (0==n) {

		S.push_back(pre);

		return;

	}

	char cc='a';

	while (maxc-cc>=0) {

		if (cc!=d) {

			string pre1=pre;

			for (int i=1; i<=n; i++) {

				pre1 +=cc;

				if (cc==maxc)

					FF(pre1, c+1, cc, maxc+1, n-i, S);

				else

					FF(pre1, c+1, cc, maxc, n-i, S);

			}

		}

		cc+=1;

	}

	return;

}



int	main() {

	int N;

	cin >>N;

	vector<string> S;

	FF("", 'a', 'z', 'a', N, S);

	Sort(S);

	for (int i=0; i<S.size(); i++)

		cout <<S.at(i) <<endl;

	return 0;

}




// Faster C++ solution for the same problem (measured speedup: 1.137624211971658x):
#include	<bits/stdc++.h>

using	namespace	std;

typedef	long long ll;



// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)

// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)



// lower_bound(A.begin(), A.end(), N)

// upper_bound(...



// A.erase(unique(A.begin(), A.end()), A.end())



// bit: &/and, |/or, ^/xor, ~/not



// getline(cin, String)

// while (getline(cin, S)) {}



// #include <cstdio>

// int a;

// scanf("%d", &a);

// printf("%d\n", a);

//

// for (int i=0; i<n; ++i)

// 	scanf("%d", &a[i]);

//

// char c;

// scanf(" %c", &c);

//

// cout << "\n";



// cout <<fixed <<setprecision(10)



// priority_queue<int> q;

// priority_queue<int, vector<int>, less<int>> q; // Default: vector, less

// priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> q;



// Graph

// Warshall-Floyd: Distance between each node, N^3

// Dijkstra: Distance from the start node, N^2

// DFS(Depth-First Search)



//

// Notes

//

// When specified less than N, try full scan.

// RE: empty vector

// Check Qs

// long/int

// xor -> count each bit

// Check values

// 	1,000,000 -> Loop

// 	100,000	-> vector(int:400KB, long:800KB) 



#define	INF (1<<30)

//1,073,741,824

//= 536,870,912 *2



#define	MOD 1000000007



/*

ll	myPow(ll x, ll n) {

	if (0==n)

		return 1;

	if (0==n%2)

		return myPow(x*x%MOD, n/2);

	else

		return x*myPow(x, n-1)%MOD;

}

*/

ll	myPow(ll x, ll n) {

	ll r=1;

	while(n>0)

		if (0==n%2) {

			x *=x;

			x %=MOD;

			n /=2;

		} else {

			r *=x;

			r %=MOD;

			n--;

		}

	return r;

}



#define	Rep0(i, n)	for (int i=0; i<n; i++)

#define	Rep1(i, n)	for (int i=1; i<=n; i++)

#define Sort(P)	sort(P.begin(), P.end())

#define Rev(P)	reverse(P.begin(), P.end())



void	FFF(const string pre, const char maxc, const int n, vector<string> &S) {

	if (0==n) {

		S.push_back(pre);

		return;

	}

	char cc='a';

	while (maxc-cc>=0) {

		string pre1=pre;

		pre1 +=cc;

		if (cc==maxc)

			FFF(pre1, maxc+1, n-1, S);

		else

			FFF(pre1, maxc, n-1, S);

		cc+=1;

	}

	return;

}



int	main() {

	int N;

	cin >>N;

	vector<string> S;

	FFF("", 'a', N, S);

	//Sort(S);

	for (int i=0; i<S.size(); i++)

		cout <<S.at(i) <<endl;

	return 0;

}