import math

al = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]

N = int(input())
S = [[""] * math.factorial(i+1) for i in range(N-1)]

S[0][0] = al[0]
for i in range(1, N-1):
  prev_S = S[i-1]
  al_use = al[:i+1]
  S[i] = [s + a for s in prev_S for a in al_use]

prev_S = S[N-2]
al_use = al[:N]
for s in prev_S:
  for a in al_use:
    print(s + a)
