import sys

sys.setrecursionlimit(10 ** 6)



def create_li(li):

  if len(li) >= n:

    lis.append(li)

    return

  p = max(li)

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

    cp = li[:]

    cp.append(i)

 #   print(cp)

    create_li(cp)



lis = []

  

n = int(eval(input()))

pre = [1]

create_li(pre)

lis.sort()

al = ["a","b","c","d","e","f","g","h","i","j"]

ans = set(["".join([al[id-1] for id in i]) for i in lis])

ans = list(ans)

ans.sort()

for i in ans:

  print(i)
from collections import deque



n = int(eval(input()))



def dfs(n):

  stack = deque()

  stack.append("a")

  while stack:

    q = stack.popleft()

    if len(q) == n:

      ans.append(q) 

    if len(q) < n:

      for i in range(ord("a"), ord(max(q)) + 2):

        stack.append(q + chr(i))

    

ans = []

dfs(n)



print(("\n".join(ans)))
import sys

sys.setrecursionlimit(10**6)


def create_li(li):
    if len(li) >= n:
        lis.append(li)
        return
    p = max(li)
    for i in range(1, p + 2):
        cp = li[:]
        cp.append(i)
        #   print(cp)
        create_li(cp)


lis = []
n = int(eval(input()))
pre = [1]
create_li(pre)
lis.sort()
al = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]
ans = set(["".join([al[id - 1] for id in i]) for i in lis])
ans = list(ans)
ans.sort()
for i in ans:
    print(i)

from collections import deque

n = int(eval(input()))


def dfs(n):
    stack = deque()
    stack.append("a")
    while stack:
        q = stack.popleft()
        if len(q) == n:
            ans.append(q)
        if len(q) < n:
            for i in range(ord("a"), ord(max(q)) + 2):
                stack.append(q + chr(i))


ans = []
dfs(n)
print(("\n".join(ans)))

-import sys +from collections import deque -sys.setrecursionlimit(10**6) +n = int(eval(input())) -def create_li(li): -    if len(li) >= n: -        lis.append(li) -        return -    p = max(li) -    for i in range(1, p + 2): -        cp = li[:] -        cp.append(i) -        #   print(cp) -        create_li(cp) +def dfs(n): +    stack = deque() +    stack.append("a") +    while stack: +        q = stack.popleft() +        if len(q) == n: +            ans.append(q) +        if len(q) < n: +            for i in range(ord("a"), ord(max(q)) + 2): +                stack.append(q + chr(i)) -lis = [] -n = int(eval(input())) -pre = [1] -create_li(pre) -lis.sort() -al = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"] -ans = set(["".join([al[id - 1] for id in i]) for i in lis]) -ans = list(ans) -ans.sort() -for i in ans: -    print(i) +ans = [] +dfs(n) +print(("\n".join(ans)))