from collections import deque

n=int(eval(input()))



alpha=['a','b','c','d','e','f','g','h','i','j','k']



q=deque(['a'])



for i in range(n-1):

    qi_ans=[]

    while(len(q)>0):

        qi=q.popleft()

        qiword_maxind=0

        for j in range(len(qi)):

            qi_ans.append(qi+qi[j])

            qij_ind=alpha.index(qi[j])

            if(qiword_maxind<qij_ind):

                qiword_maxind=qij_ind

        else:

            qi_ans.append(qi+alpha[qiword_maxind+1])

    qi_ans=sorted(list(set(qi_ans)))

#    print(qi_ans)

    q.extend(qi_ans)



lenq=len(q)

for i in range(lenq):

    print((q.popleft()))

from collections import deque

n=int(eval(input()))



alpha=list('abcdefghijk')



q=deque([])

q.append(alpha[0])



for i in range(1,n):

    qi=deque([])



    while(len(q)>0):

        qij=q.popleft()

        qij_setnum=len(set(list(qij)))

        for j in range(qij_setnum+1):

            qi.append(qij+alpha[j])



    q=qi



q=list(q)

q.sort()

for i in range(len(q)):

    print((q[i]))
from collections import deque

n = int(eval(input()))
alpha = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k"]
q = deque(["a"])
for i in range(n - 1):
    qi_ans = []
    while len(q) > 0:
        qi = q.popleft()
        qiword_maxind = 0
        for j in range(len(qi)):
            qi_ans.append(qi + qi[j])
            qij_ind = alpha.index(qi[j])
            if qiword_maxind < qij_ind:
                qiword_maxind = qij_ind
        else:
            qi_ans.append(qi + alpha[qiword_maxind + 1])
    qi_ans = sorted(list(set(qi_ans)))
    #    print(qi_ans)
    q.extend(qi_ans)
lenq = len(q)
for i in range(lenq):
    print((q.popleft()))

from collections import deque

n = int(eval(input()))
alpha = list("abcdefghijk")
q = deque([])
q.append(alpha[0])
for i in range(1, n):
    qi = deque([])
    while len(q) > 0:
        qij = q.popleft()
        qij_setnum = len(set(list(qij)))
        for j in range(qij_setnum + 1):
            qi.append(qij + alpha[j])
    q = qi
q = list(q)
q.sort()
for i in range(len(q)):
    print((q[i]))

-alpha = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k"] -q = deque(["a"]) -for i in range(n - 1): -    qi_ans = [] +alpha = list("abcdefghijk") +q = deque([]) +q.append(alpha[0]) +for i in range(1, n): +    qi = deque([]) -        qi = q.popleft() -        qiword_maxind = 0 -        for j in range(len(qi)): -            qi_ans.append(qi + qi[j]) -            qij_ind = alpha.index(qi[j]) -            if qiword_maxind < qij_ind: -                qiword_maxind = qij_ind -        else: -            qi_ans.append(qi + alpha[qiword_maxind + 1]) -    qi_ans = sorted(list(set(qi_ans))) -    #    print(qi_ans) -    q.extend(qi_ans) -lenq = len(q) -for i in range(lenq): -    print((q.popleft())) +        qij = q.popleft() +        qij_setnum = len(set(list(qij))) +        for j in range(qij_setnum + 1): +            qi.append(qij + alpha[j]) +    q = qi +q = list(q) +q.sort() +for i in range(len(q)): +    print((q[i]))