n=int(eval(input()))

char=[chr(i) for i in range(97, 97+26)]



ans=["a"]

before=0



for i in range(2,n+1):

    for c in range(len(ans)):

        From=char.index(sorted(list(ans[c]))[-1])

        for m in range(From+2):

            ans.append(ans[c]+char[m])

    #print(ans)

    

b=[]



for g in range(len(ans)):

    if len(ans[g])==n:

        b.append(ans[g])



b.sort()



for i in range(len(b)):

    print((b[i]))
import sys

sys.setrecursionlimit(10**9)



N = int(eval(input()))



def bfs(s, cnt, m):

	if cnt == N:

		print(s)

		return



	for i in range(97,ord(m)+2):

		if chr(i) > m:

			bfs(s+chr(i), cnt+1, chr(i))

		else:

			bfs(s+chr(i), cnt+1, m)



bfs('a',1,'a')
n = int(eval(input()))
char = [chr(i) for i in range(97, 97 + 26)]
ans = ["a"]
before = 0
for i in range(2, n + 1):
    for c in range(len(ans)):
        From = char.index(sorted(list(ans[c]))[-1])
        for m in range(From + 2):
            ans.append(ans[c] + char[m])
    # print(ans)
b = []
for g in range(len(ans)):
    if len(ans[g]) == n:
        b.append(ans[g])
b.sort()
for i in range(len(b)):
    print((b[i]))

import sys

sys.setrecursionlimit(10**9)
N = int(eval(input()))


def bfs(s, cnt, m):
    if cnt == N:
        print(s)
        return
    for i in range(97, ord(m) + 2):
        if chr(i) > m:
            bfs(s + chr(i), cnt + 1, chr(i))
        else:
            bfs(s + chr(i), cnt + 1, m)


bfs("a", 1, "a")

-n = int(eval(input())) -char = [chr(i) for i in range(97, 97 + 26)] -ans = ["a"] -before = 0 -for i in range(2, n + 1): -    for c in range(len(ans)): -        From = char.index(sorted(list(ans[c]))[-1]) -        for m in range(From + 2): -            ans.append(ans[c] + char[m]) -    # print(ans) -b = [] -for g in range(len(ans)): -    if len(ans[g]) == n: -        b.append(ans[g]) -b.sort() -for i in range(len(b)): -    print((b[i])) +import sys + +sys.setrecursionlimit(10**9) +N = int(eval(input())) + + +def bfs(s, cnt, m): +    if cnt == N: +        print(s) +        return +    for i in range(97, ord(m) + 2): +        if chr(i) > m: +            bfs(s + chr(i), cnt + 1, chr(i)) +        else: +            bfs(s + chr(i), cnt + 1, m) + + +bfs("a", 1, "a")