n = int(input())
if n == 1:
  hoge = ["a"]
  for i in range(len(hoge)):
    print(i)
if n == 2:
  hoge = ["aa", "ab"]
  for i in range(len(hoge)):
    print(i)
if n == 3:
  hoge = []
  for a in ["a", "b", "c"]:
    for b in ["b", "c"]:
      for c in ["c"]:
        hoge.append(a + b + c)
  hoge.sort()
  for i in range(len(hoge)):
    print(i)

if n == 4:
  hoge = []
  for a in ["a", "b", "c", "d"]:
    for b in ["b", "c", "d"]:
      for c in ["c", "d"]:
        for d in ["d"]:
          hoge.append(a + b + c + d)
  hoge.sort()
  for i in range(len(hoge)):
    print(i)