from copy import deepcopy


def f(num,N,S):
    alphabet = ["a","b","c","d","e","f","g","h","i","j","k"]
    if N == num:
        for i in range(len(S)):
            print(S[i])
        return
    else:
        tmp = []
        length = len(S)
        for i in range(length):
            if i == 0:
                tmp.append(S[0]+"a")
                tmp.append(S[0]+"b")
            elif i == length-1:
                for j in range(num+1):
                    tmp.append(S[-1]+alphabet[j])
            else:
                for j in range(num):
                    tmp.append(S[i]+alphabet[j])
        S = deepcopy(tmp)
        S.sort()
        f(num+1,N,S)

N = int(input())
f(1,N,["a"])