def DFS(s, mx):
    if len(s) == N:
        print(s)
        return
    c = 'a'
    while c <= chr(ord(mx)+1):
        t = s + c
        DFS(t, chr(max(ord(c), ord(mx))))
        c = chr(ord(c) + 1)
DFS("", chr(ord('a')-1))