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')
def dfs(cnt, s, now):

    if cnt == n:

        ans.append(s)

        return

    for i in range(now+1):

        dfs(cnt+1, s+al[i], max(i+1, now))



n = int(eval(input()))

ans = []

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

dfs(0, "", 0)

for i in ans:

    print(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")

def dfs(cnt, s, now):
    if cnt == n:
        ans.append(s)
        return
    for i in range(now + 1):
        dfs(cnt + 1, s + al[i], max(i + 1, now))


n = int(eval(input()))
ans = []
al = [chr(i) for i in range(97, 97 + 26)]
dfs(0, "", 0)
for i in ans:
    print(i)

-import sys - -sys.setrecursionlimit(10**9) -N = int(eval(input())) +def dfs(cnt, s, now): +    if cnt == n: +        ans.append(s) +        return +    for i in range(now + 1): +        dfs(cnt + 1, s + al[i], max(i + 1, now)) -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())) +ans = [] +al = [chr(i) for i in range(97, 97 + 26)] +dfs(0, "", 0) +for i in ans: +    print(i)