n = int(eval(input()))



alphabet = 'abcdefghij'

s = [-1 for i in range(n)]

lst = [[] for i in range(n)]

lst[0].append(0)

ind = 0

while lst[ind] != [] or ind > 0:

    if ind < n-1 and lst[ind] != []:

        s[ind] = lst[ind].pop()

        for i in range(max(s)+1, -1, -1):

            lst[ind+1].append(i)

        ind += 1

    else:

        while lst[ind] != []:

            s[ind] = lst[ind].pop()

            ans = [alphabet[i] for i in s]

            print((''.join(ans)))

        s[ind] = -1

        ind -= 1
n = int(eval(input()))



if n == 1:

    print('a')

    exit()



lst = ['a']

for i in range(n-1):

    new_lst = []

    for string in lst:

        num = ord(sorted(string)[-1])

        for j in range(ord('a'), num+2):

            new_lst.append(string+chr(j))

    lst = new_lst



for string in lst:

    print(string)
n = int(eval(input()))
alphabet = "abcdefghij"
s = [-1 for i in range(n)]
lst = [[] for i in range(n)]
lst[0].append(0)
ind = 0
while lst[ind] != [] or ind > 0:
    if ind < n - 1 and lst[ind] != []:
        s[ind] = lst[ind].pop()
        for i in range(max(s) + 1, -1, -1):
            lst[ind + 1].append(i)
        ind += 1
    else:
        while lst[ind] != []:
            s[ind] = lst[ind].pop()
            ans = [alphabet[i] for i in s]
            print(("".join(ans)))
        s[ind] = -1
        ind -= 1

n = int(eval(input()))
if n == 1:
    print("a")
    exit()
lst = ["a"]
for i in range(n - 1):
    new_lst = []
    for string in lst:
        num = ord(sorted(string)[-1])
        for j in range(ord("a"), num + 2):
            new_lst.append(string + chr(j))
    lst = new_lst
for string in lst:
    print(string)

-alphabet = "abcdefghij" -s = [-1 for i in range(n)] -lst = [[] for i in range(n)] -lst[0].append(0) -ind = 0 -while lst[ind] != [] or ind > 0: -    if ind < n - 1 and lst[ind] != []: -        s[ind] = lst[ind].pop() -        for i in range(max(s) + 1, -1, -1): -            lst[ind + 1].append(i) -        ind += 1 -    else: -        while lst[ind] != []: -            s[ind] = lst[ind].pop() -            ans = [alphabet[i] for i in s] -            print(("".join(ans))) -        s[ind] = -1 -        ind -= 1 +if n == 1: +    print("a") +    exit() +lst = ["a"] +for i in range(n - 1): +    new_lst = [] +    for string in lst: +        num = ord(sorted(string)[-1]) +        for j in range(ord("a"), num + 2): +            new_lst.append(string + chr(j)) +    lst = new_lst +for string in lst: +    print(string)