N = int(input())
import itertools
from collections import deque
ans = deque()
l = []
r = deque()
for i in range(N):
  l.append(chr(97+i))
  r.append(l.copy())
  
p = [[] for _ in range(N)]
p[0].append('a')
for i in range(1,N):
  for j in r[i]:
    for k in p[i-1]:
      p[i].append(k+j)
      
p = p[-1]
for i in p:
  a = [0]*10
  for j in i:
    x = ord(j)-97
    a[x]=1
    if x==0:
      judge = True
      continue
    elif a[x-1]==1:
      judge = True
      continue
    else:
      judge = False
      break
  if judge:
    ans.append(i)
ans = set(ans)
ans = sorted(list(ans))
for a in ans:
  print(a)