from collections import deque

D1 = {i:chr(i+96) for i in range(1,27)}

D2 = {val:key for key,val in list(D1.items())}



N = int(eval(input()))

heap = deque([(D1[1],1)])

A = []

while heap:

    a,n = heap.popleft()

    if n<N:

        imax = 0

        for i in range(len(a)):

            imax = max(imax,D2[a[i]])

        for i in range(1,min(imax+1,26)+1):

            heap.append((a+D1[i],n+1))

    if n==N:

        A.append(a)

A = sorted(list(set(A)))

for i in range(len(A)):

    print((A[i]))
from collections import deque

D1 = {i:chr(i+96) for i in range(1,27)}

D2 = {val:key for key,val in list(D1.items())}

N = int(eval(input()))

que = deque([("a",1)])

A = []

while que:

    x,n = que.popleft()

    if n<N:

        imax = 0

        for i in range(len(x)):

            imax = max(imax,D2[x[i]])

        for j in range(1,min(imax+1,26)+1):

            que.append((x+D1[j],n+1))

    else:

        A.append(x)

A = sorted(list(set(A)))

for i in range(len(A)):

    print((A[i]))
from collections import deque

D1 = {i: chr(i + 96) for i in range(1, 27)}
D2 = {val: key for key, val in list(D1.items())}
N = int(eval(input()))
heap = deque([(D1[1], 1)])
A = []
while heap:
    a, n = heap.popleft()
    if n < N:
        imax = 0
        for i in range(len(a)):
            imax = max(imax, D2[a[i]])
        for i in range(1, min(imax + 1, 26) + 1):
            heap.append((a + D1[i], n + 1))
    if n == N:
        A.append(a)
A = sorted(list(set(A)))
for i in range(len(A)):
    print((A[i]))

from collections import deque

D1 = {i: chr(i + 96) for i in range(1, 27)}
D2 = {val: key for key, val in list(D1.items())}
N = int(eval(input()))
que = deque([("a", 1)])
A = []
while que:
    x, n = que.popleft()
    if n < N:
        imax = 0
        for i in range(len(x)):
            imax = max(imax, D2[x[i]])
        for j in range(1, min(imax + 1, 26) + 1):
            que.append((x + D1[j], n + 1))
    else:
        A.append(x)
A = sorted(list(set(A)))
for i in range(len(A)):
    print((A[i]))

-heap = deque([(D1[1], 1)]) +que = deque([("a", 1)]) -while heap: -    a, n = heap.popleft() +while que: +    x, n = que.popleft() -        for i in range(len(a)): -            imax = max(imax, D2[a[i]]) -        for i in range(1, min(imax + 1, 26) + 1): -            heap.append((a + D1[i], n + 1)) -    if n == N: -        A.append(a) +        for i in range(len(x)): +            imax = max(imax, D2[x[i]]) +        for j in range(1, min(imax + 1, 26) + 1): +            que.append((x + D1[j], n + 1)) +    else: +        A.append(x)