import itertools
n = int(input())
ans = []
pre = []

num = "abcdefghijklmnopqrstuvwxyz"
dn = ""
for i in range(n):
    dn += 'z'

def sep(x, y):
    for i in range(len(x) - 1):
        for j in range(i + 1, len(x)):
            if x[i] == x[j]:
                if y[i] != y[j]: return False
            else:
                if y[i] == y[j]: return False
    return True

s = []
for i in range(n):
    for j in range(n - i):
        s.append(num[j])
for v in itertools.permutations(s, n):
    u = ""
    for t in v:
        u += t
    pre.append(u)
ans = list(set(pre))
ans.sort()
for x in range(len(ans) - 1):
    for y in range(x + 1, len(ans)):
        if ans[x] == dn or ans[y] == dn: continue
        if sep(ans[x], ans[y]):
            ans[y] = dn
for x in ans:
    if x == dn: continue
    print(x)