def rec(S,depth):
    if depth == 0:
        print(S)
        return
    else:
        list_mozi=list(dict.fromkeys(list(S)))
        for j in range(len(list_mozi)):
            rec(S+list_mozi[j],depth-1)
        rec(S+chr(ord(list_mozi[len(list_mozi)-1])+1),depth-1)

N=int(input())
rec("a",N-1)
