def dfs(y):
    global cnt,x
    if cnt==N:
        A.append(x)
        return
    for z in G[y]:
        x += z
        cnt += 1
        dfs(z)
        x = x[:-1]
        cnt -= 1
N = int(input())
G = {chr(i):[chr(j) for j in range(97,i+2)] for i in range(97,97+N-1)}
A = []
x = "a"
cnt = 1
dfs(x)
A = sorted(A)
for a in A:
    print(a)