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

public class Hello
{
    public static void Main()
    {
        hoge();
        //System.Console.ReadLine();
    }

    public static void hoge()
    {
        var vars = System.Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var n = vars[0];

        var ans = new List<string>();

        int[] keta = new int[n];
        System.Console.WriteLine(new string(keta.Reverse().Select(x => (char)('a' + (char)(x))).ToArray()));
        var i = 0;
        while (true)
        {
            var up = addKeta(keta, i);
            System.Console.WriteLine(new string(keta.Reverse().Select(x => (char)('a' + (char)(x))).ToArray()));
            if(keta.GroupBy(x => x).Count() == keta.Length)
            {
                break;
            }
            if (up)
            {
                while (true)
                {
                    keta[i] = 0;
                    i++;
                    if (!noaddKeta(keta, i))
                    {
                        break;
                    }
                }
                
            }
            else
            {
                i = 0;
            }
        }
    }

    public static bool addKeta(int[] keta, int i)
    {
        keta[i] += 1;
        if(i > 0 && keta[i - 1] <= keta[i] )
        {
            return false;
        }
        return keta[i] > keta[i + 1];
    }

    public static bool noaddKeta(int[] keta, int i)
    {
        return keta[i] > keta[i + 1];
    }
}

