n = int(input())

alphabet = 'abcdefghij'
s = [-1 for i in range(n)]
lst = [[] for i in range(n)]
lst[0].append(0)
ind = 0
while lst[ind] != [] or ind > 0:
    if ind < n-1 and lst[ind] != []:
        s[ind] = lst[ind].pop()
        for i in range(s[ind]+1, -1, -1):
            lst[ind+1].append(i)
        ind += 1
    else:
        while lst[ind] != []:
            s[ind] = lst[ind].pop()
            ans = [alphabet[i] for i in s]
            print(''.join(ans))
        ind -= 1