import sys
import re

l = sys.stdin.readline()
l = int(l)
out = []
def x(stri,l,depth):
  str = 'abcdefghij'
  use = 0
  for i in range(0,l-depth+1):
    if( use == 1):
      break
    cdepth = depth
    cstri = stri
    if ( str[i] not in cstri):
      use = 1
    cstri += str[i] 
    cdepth -= 1
    if( cdepth == 0):
	out.append(cstri)
    else:
	x(cstri,l,cdepth)


stri = 'a'
if( l == 1):
 print stri
 exit(0)
x(stri,l,l-1)

count = 0
for i in out:
  print i


sys.stdout.flush()
