def f(n, count=0, i=0, lst=[]):

    global ans

    if count == n:

        s = ""

        for j in range(count):

            s += chr(ord("a") + lst[j])

        ans.append(s)

        return

    if i == 0:

        lst.append(i)

        f(n, count + 1, i=i+1, lst=lst)

    else:

        for j in range(i + 1):

            f(n, count + 1, i=max(i, j + 1), lst=lst+[j])



import sys

sys.setrecursionlimit(10000)

n = int(eval(input()))

ans = []

f(n)

ans.sort()

for i in ans:

    print(i)
def f(n, count=0, i=0, s=""):

    global ans

    if count == n:

        ans.append(s)

        return

    if i == 0:

        f(n, count + 1, i=i+1, s=s+"a")

    else:

        for j in range(i + 1):

            f(n, count + 1, i=max(i, j + 1), s=s+chr(ord("a") + j))



import sys

sys.setrecursionlimit(10000)

n = int(eval(input()))

ans = []

f(n)

ans.sort()

for i in ans:

    print(i)
def f(n, count=0, i=0, lst=[]):
    global ans
    if count == n:
        s = ""
        for j in range(count):
            s += chr(ord("a") + lst[j])
        ans.append(s)
        return
    if i == 0:
        lst.append(i)
        f(n, count + 1, i=i + 1, lst=lst)
    else:
        for j in range(i + 1):
            f(n, count + 1, i=max(i, j + 1), lst=lst + [j])


import sys

sys.setrecursionlimit(10000)
n = int(eval(input()))
ans = []
f(n)
ans.sort()
for i in ans:
    print(i)

def f(n, count=0, i=0, s=""):
    global ans
    if count == n:
        ans.append(s)
        return
    if i == 0:
        f(n, count + 1, i=i + 1, s=s + "a")
    else:
        for j in range(i + 1):
            f(n, count + 1, i=max(i, j + 1), s=s + chr(ord("a") + j))


import sys

sys.setrecursionlimit(10000)
n = int(eval(input()))
ans = []
f(n)
ans.sort()
for i in ans:
    print(i)

-def f(n, count=0, i=0, lst=[]): +def f(n, count=0, i=0, s=""): -        s = "" -        for j in range(count): -            s += chr(ord("a") + lst[j]) -        lst.append(i) -        f(n, count + 1, i=i + 1, lst=lst) +        f(n, count + 1, i=i + 1, s=s + "a") -            f(n, count + 1, i=max(i, j + 1), lst=lst + [j]) +            f(n, count + 1, i=max(i, j + 1), s=s + chr(ord("a") + j))