import sys



sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))



N = ir()

A = [[0]]

limit = 0

for i in range(N-1):

    B = []

    for j in range(limit + 2):

        for x in A:

            if max(x) + 1 < j:

                continue

            y = x + [j]

            B.append(y)

    A = B

    limit += 1



A = [tuple(x) for x in A]

A = sorted(set(A))

for x in A:

    x = [chr(y + ord('a')) for y in x]

    print((''.join(x)))

import sys



sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))



N = ir()



def dfs(s, limit):

    if len(s) == N:

        print(s)

    else:

        for i in range(limit+2):

            x = chr(i + ord('a'))

            dfs(s + x, max(limit, i))



dfs('a', 0)

# 23
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
A = [[0]]
limit = 0
for i in range(N - 1):
    B = []
    for j in range(limit + 2):
        for x in A:
            if max(x) + 1 < j:
                continue
            y = x + [j]
            B.append(y)
    A = B
    limit += 1
A = [tuple(x) for x in A]
A = sorted(set(A))
for x in A:
    x = [chr(y + ord("a")) for y in x]
    print(("".join(x)))

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()


def dfs(s, limit):
    if len(s) == N:
        print(s)
    else:
        for i in range(limit + 2):
            x = chr(i + ord("a"))
            dfs(s + x, max(limit, i))


dfs("a", 0)
# 23

-A = [[0]] -limit = 0 -for i in range(N - 1): -    B = [] -    for j in range(limit + 2): -        for x in A: -            if max(x) + 1 < j: -                continue -            y = x + [j] -            B.append(y) -    A = B -    limit += 1 -A = [tuple(x) for x in A] -A = sorted(set(A)) -for x in A: -    x = [chr(y + ord("a")) for y in x] -    print(("".join(x))) + + +def dfs(s, limit): +    if len(s) == N: +        print(s) +    else: +        for i in range(limit + 2): +            x = chr(i + ord("a")) +            dfs(s + x, max(limit, i)) + + +dfs("a", 0) +# 23