import copy



N = int(eval(input()))

w  = [['a']]

for n in range(1,N):

    nw = [[] for _ in range(n+1)]

    for i in range(n):

        nw[i] += [x+chr(97+j) for j in range(i+1) for x in w[i]]

        nw[i+1] += [x+chr(97+i+1) for x in w[i]]

    w = copy.deepcopy(nw)



ans = []

for i in range(N):

    ans += [x for x in w[i]]

for x in sorted(ans):

    print(x)
from collections import deque

N = int(eval(input()))

que = deque(['a'])



while len(que) > 0:

    s = que.popleft()

    if len(s) == N:

        print(s)

    else:

        for i in range(ord(sorted(s)[-1]) - 95):

            que.append(s + chr(97 + i))
import copy

N = int(eval(input()))
w = [["a"]]
for n in range(1, N):
    nw = [[] for _ in range(n + 1)]
    for i in range(n):
        nw[i] += [x + chr(97 + j) for j in range(i + 1) for x in w[i]]
        nw[i + 1] += [x + chr(97 + i + 1) for x in w[i]]
    w = copy.deepcopy(nw)
ans = []
for i in range(N):
    ans += [x for x in w[i]]
for x in sorted(ans):
    print(x)

from collections import deque

N = int(eval(input()))
que = deque(["a"])
while len(que) > 0:
    s = que.popleft()
    if len(s) == N:
        print(s)
    else:
        for i in range(ord(sorted(s)[-1]) - 95):
            que.append(s + chr(97 + i))

-import copy +from collections import deque -w = [["a"]] -for n in range(1, N): -    nw = [[] for _ in range(n + 1)] -    for i in range(n): -        nw[i] += [x + chr(97 + j) for j in range(i + 1) for x in w[i]] -        nw[i + 1] += [x + chr(97 + i + 1) for x in w[i]] -    w = copy.deepcopy(nw) -ans = [] -for i in range(N): -    ans += [x for x in w[i]] -for x in sorted(ans): -    print(x) +que = deque(["a"]) +while len(que) > 0: +    s = que.popleft() +    if len(s) == N: +        print(s) +    else: +        for i in range(ord(sorted(s)[-1]) - 95): +            que.append(s + chr(97 + i))