using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace AtCoder {
	class Program {
		public static void Main(string[] args) {
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });

			int n = int.Parse(Console.ReadLine());
			List<string> list = new List<string> { "a" };
			for (int i = 1; i < n; i++) {
				for (int j = 0; j < list.Count; j++) {
					if (list[j].Length == i) {
						char last = list[j].Max();
						for (int k = 0; k <= last - 'a' + 1; k++) {
							list.Insert(j + k+1, list[j] + ((char)('a' + k)).ToString());
						}
					}
				}
			}
			for (int i = 0; i < list.Count; i++) if (list[i].Length < n) { list.RemoveAt(i); i--; }

			Console.WriteLine(string.Join("\n", list));

			Console.Out.Flush();
		}
	}
}
