#!python3.4.3

import itertools

def report(x):
  tmp = []
  r = ''
  for c in x:
    if c not in tmp:
      tmp.append(c)
    r += str(tmp.index(c))

  return r

n = int(input())
s = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
report_list = []

for i, v in enumerate(itertools.product(s[0:n], repeat=n)):
  temp = ''.join(v)
  
  if report(temp) not in report_list:
    report_list.append(report(temp))
    print(temp)
