#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>

using ll = unsigned long long;

using mymap = std::unordered_map<std::pair<char, int>, std::vector<std::string>>;
mymap memo;

std::vector<std::string> f(char c, int depth)
{
	if (depth == 1)
	{
		std::string s;
		s.push_back(c);
		return std::vector<std::string>{s};
	}
	//else if (memo.at(std::make_pair(c, depth)))
	//{
	//
	//}

	std::vector<std::string> v;
	for (char i = 'a'; i <= c + 1; i++)
	{
		for (std::string s : f(i, depth - 1))
		{
			v.push_back(c + s);
		}
	}

	
	return v;
}

int main()
{
	int N;
	std::cin >> N;

	std::vector<std::string> ans = f('a', N);
	for (const std::string &s : ans)
	{
		std::cout << s << std::endl;
	}
}

