n = int(input())
s = [('', 0)]
cnt = 0
ans = []
while s:
    t, k = s.pop()
    if len(t) == n:
        print(t)
    else:
        s.append((t + chr(k + 97), k + 1))
        for i in range(k - 1, -1, -1):
            s.append((t + chr(i + 97), k))
