N = int(input())



lst = [['a']]

for i in range(N - 1):

    n = len(lst)

    tmp_lst = []

    tmp_append = tmp_lst.append

    for j in range(n):

        tmp = lst[j]

        count = len(set(tmp))

        for k in range(count + 1):

            tmp_append(tmp + [chr(k + 97)])

    lst = tmp_lst

lst.sort()



for tmp in lst:

    print (*tmp, sep = '')

import sys

input = sys.stdin.readline

sys.setrecursionlimit(10 ** 9)

MOD = 10 ** 9 + 7



N = int(eval(input()))



lst1 = [('a', 0)]

lst2 = []

for i in range(N - 1):

    if i % 2 == 0: #lst1 -->lst2

        lst2 = []

        for s, t in lst1:

            last = max(ord(s[i]) - ord('a'), t)

            for j in range(last + 2):

                lst2.append((s + chr(j + ord('a')), max(t, j)))

    else:

        lst1 = []

        for s, t in lst2:

            last = max(ord(s[i]) - ord('a'), t)

            for j in range(last + 2):

                lst1.append((s + chr(j + ord('a')), (max(t, j))))

           

if len(lst2) > len(lst1):

    lst2.sort()

    for s, t in lst2:

        print (s)

else:

    lst1.sort()

    for s, t in lst1:

        print (s)
N = int(input())
lst = [["a"]]
for i in range(N - 1):
    n = len(lst)
    tmp_lst = []
    tmp_append = tmp_lst.append
    for j in range(n):
        tmp = lst[j]
        count = len(set(tmp))
        for k in range(count + 1):
            tmp_append(tmp + [chr(k + 97)])
    lst = tmp_lst
lst.sort()
for tmp in lst:
    print(*tmp, sep="")

import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**9)
MOD = 10**9 + 7
N = int(eval(input()))
lst1 = [("a", 0)]
lst2 = []
for i in range(N - 1):
    if i % 2 == 0:  # lst1 -->lst2
        lst2 = []
        for s, t in lst1:
            last = max(ord(s[i]) - ord("a"), t)
            for j in range(last + 2):
                lst2.append((s + chr(j + ord("a")), max(t, j)))
    else:
        lst1 = []
        for s, t in lst2:
            last = max(ord(s[i]) - ord("a"), t)
            for j in range(last + 2):
                lst1.append((s + chr(j + ord("a")), (max(t, j))))
if len(lst2) > len(lst1):
    lst2.sort()
    for s, t in lst2:
        print(s)
else:
    lst1.sort()
    for s, t in lst1:
        print(s)

-N = int(input()) -lst = [["a"]] +import sys + +input = sys.stdin.readline +sys.setrecursionlimit(10**9) +MOD = 10**9 + 7 +N = int(eval(input())) +lst1 = [("a", 0)] +lst2 = [] -    n = len(lst) -    tmp_lst = [] -    tmp_append = tmp_lst.append -    for j in range(n): -        tmp = lst[j] -        count = len(set(tmp)) -        for k in range(count + 1): -            tmp_append(tmp + [chr(k + 97)]) -    lst = tmp_lst -lst.sort() -for tmp in lst: -    print(*tmp, sep="") +    if i % 2 == 0:  # lst1 -->lst2 +        lst2 = [] +        for s, t in lst1: +            last = max(ord(s[i]) - ord("a"), t) +            for j in range(last + 2): +                lst2.append((s + chr(j + ord("a")), max(t, j))) +    else: +        lst1 = [] +        for s, t in lst2: +            last = max(ord(s[i]) - ord("a"), t) +            for j in range(last + 2): +                lst1.append((s + chr(j + ord("a")), (max(t, j)))) +if len(lst2) > len(lst1): +    lst2.sort() +    for s, t in lst2: +        print(s) +else: +    lst1.sort() +    for s, t in lst1: +        print(s)