N=int(input())
alpha=["a","b","c","d","e","f","g","h","i","j"]
from collections import deque
que=deque(["0"])
ans=[]
after=[]
while que:
   A=que.popleft()
   after.append(A)
   if len(A)==N:
      ans.append(A)
   else:
      if A+str(int(A[-1])+1) not in after:
         que.append(A+str(int(A[-1])+1))
      if A+str(int(A[-1])) not in after:
         que.append(A+str(int(A[-1])))
      if A+str(int(A[-1])-1) not in after and int(A[-1])!=0:
         que.append(A+str(int(A[-1])-1))
l=[]
for i in ans:
   tmp=""
   for j in i:
      tmp+=alpha[int(j)]
   l.append(tmp)
l.sort()
for i in l:print(i)