n=int(input())
tmp=[['1',set({1})]]
for i in range(1,n):
  tmp2=[]
  for s,c in tmp:
    for j in range(len(c)+1):
      tmp2.append([s+str((j+1)%10),c|set({j+1})])
  tmp=tmp2
ans=[]
dic={'1':'a','2':'b','3':'c','4':'d','5':'e','6':'f','7':'g','8':'h','9':'i','0':'k'}
for s,c in tmp:
  ts=''
  for tc in s:
    ts+=dic[tc]
  ans.append(ts)
ans=sorted(ans)
for s in ans:
  print(s)