N = int(input())
def to_str(n):
    s = [chr(i + 97) for i in reversed(n)]
    s = "".join(s)
    return s
n = [0] * N
n_max = list(reversed(list(range(N))))

s = to_str(n)
print(s)
while True:
    for j in range(N-1):
        if n[j] < n[j+1]+1:
            n[j] += 1
            for k in range(j):
                n[k] = 0
            s = to_str(n)
            print(s)
            break
    if n == n_max:
        break