N = int(input())

dic = {0:"a", 1:"b", 2:"c", 3:"d", 4:"e", 5:"f", 6:"g", 7:"h", 8:"i", 9:"j"}
dic_r = {"a":0, "b":1, "c":2, "d":3, "e":4, "f":5, "g":6, "h":7, "i":8, "j":9}

old = ["a"]
new = []
for i in range(1, N):
    for word in old:
        for j in range(i+1):
            if word[-1] == dic[j] or (j>0 and word[-1] == dic[j-1]) or dic_r[word[-1]] >= j:
                new.append(word+dic[j])
    old = new.copy()
    new = []
for i in old:
    print(i)
