using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;
	
	public class Node
	{
		public char Chara{get;set;}
		
		public List<Node> Children{get;set;}
		public int Used{get;set;}
	}
	
	public static void Main(string[] args)
	{
		var n = Console.ReadLine().ToInt();
		
		var k = new List<string>();
		var par = new Node(){Chara='a', Children=new List<Node>(), Used = 1};
		BFS(par, 0, n);
		
		var ms = new Stack<char>();
		results = new List<string>();
		WriteDown(par, ms, n);
		results.Sort(StringComparer.Ordinal);
		foreach(var st in results)
		{
			Console.WriteLine(st);
		}
	}
	
	static void BFS(Node parent, int deep, int max)
	{
		if(deep==max-1)
			return;
		for(int i = 0; i <= parent.Used; i++)
		{
			var m = new Node(){Chara=(char)('a'+i), Children=new List<Node>()};
			
			if(i <= parent.Used)
			{
				m.Used=parent.Used;
			}
			else
			{
				m.Used=parent.Used+1;
			}
			parent.Children.Add(m);
			BFS(m, deep+1, max);
		}
	}
	
	static List<string> results;
	static void WriteDown(Node parent, Stack<char> stack, int max)
	{
		if(parent == null)
			return;
		
		stack.Push(parent.Chara);
		foreach(var n in parent.Children)
		{
			WriteDown(n, stack, max);
		}
		if(stack.Count == max)
		{
			var c = stack.ToArray();
			Array.Reverse(c);
				var t = new string(c);
		
			results.Add(t);
		}
		stack.Pop();
	}

	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}