import sys

input = sys.stdin.readline

N = int(eval(input()))

res = set()

a = ord("a")

def dfs(s, x):

  global res

  if len(s) == N:

    res.add(s)

    return

  for i in range(x + 1):

    dfs(s + chr(a + i), x)

  dfs(s + chr(a + x + 1), x + 1)



dfs("a", 0)

res = sorted(res)

for r in res: print(r)
import sys

input = sys.stdin.readline

sys.setrecursionlimit(10 ** 6)

N = int(eval(input()))

res = set()

a = ord("a")

mx = lambda x: max(list(map(ord, x))) - a

def dfs(s):

  if len(s) == N:

    res.add("".join(s))

    return

  for k in range(mx(s) + 2): dfs(s + [chr(k + a)])

dfs(["a"])

for r in sorted(res): print(r)
import sys

input = sys.stdin.readline
N = int(eval(input()))
res = set()
a = ord("a")


def dfs(s, x):
    global res
    if len(s) == N:
        res.add(s)
        return
    for i in range(x + 1):
        dfs(s + chr(a + i), x)
    dfs(s + chr(a + x + 1), x + 1)


dfs("a", 0)
res = sorted(res)
for r in res:
    print(r)

import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N = int(eval(input()))
res = set()
a = ord("a")
mx = lambda x: max(list(map(ord, x))) - a


def dfs(s):
    if len(s) == N:
        res.add("".join(s))
        return
    for k in range(mx(s) + 2):
        dfs(s + [chr(k + a)])


dfs(["a"])
for r in sorted(res):
    print(r)

+sys.setrecursionlimit(10**6) +mx = lambda x: max(list(map(ord, x))) - a -def dfs(s, x): -    global res +def dfs(s): -        res.add(s) +        res.add("".join(s)) -    for i in range(x + 1): -        dfs(s + chr(a + i), x) -    dfs(s + chr(a + x + 1), x + 1) +    for k in range(mx(s) + 2): +        dfs(s + [chr(k + a)]) -dfs("a", 0) -res = sorted(res) -for r in res: +dfs(["a"]) +for r in sorted(res):