N = int(input())


def func(S):
  q = [S]
  #ans = []
  while q:
    x = q.pop()
    if len(x) == N:
      print(x)
    elif len(x) > N:
      pass
    else:
      follow = x[-1]
      for i in range(len([ char for char in x if char == follow])):
        y = x + chr(ord(follow) + 1) * (i + 1)
        q.append(y)

for i in range(N, 0, -1):
  start = 'a' * i
  func(start)