import sys
range = xrange
input = raw_input

n = int(input())

ans = []

def generate(A, i = 0, j = 0):
    if j == n:
        if all(a!=n for a in A):
            return ans.append(list(A))
        return
    if i == n:
        if all(a!=n for a in A):
            return ans.append(list(A))
        i = 0
        while A[i] != n:
            i += 1
        A[i] = j + 1
        generate(A, i + 1, j + 1)
        A[i] = n
        return
    if A[i] == n:
        A[i] = j
        generate(A, i + 1, j)
        A[i] = n
    generate(A, i + 1, j)

A = [n]*n
A[0] = 0
generate(A, 1, 0)
orda = ord('a')
print '\n'.join(''.join(chr(a + orda) for a in A) for A in sorted(ans))
