import itertools
import math

N=int(input())
cnt=0
lmt=math.factorial(N-1)
L=[chr(i) for i in range(97, 97+N)]

for v in itertools.product(L, repeat=N):
    ans=''.join(v)
    print(ans)
    cnt+=1
    if cnt>lmt:
      exit()