k = "a",

for _ in range(int(eval(input())) - 1):

  k = {a + b for a in k for b in a + chr(ord(max(a)) + 1)}

for i in sorted(k):print(i)
k = "a",

for _ in range(int(eval(input())) - 1):

  k = {a + b for a in k for b in a + chr(ord(max(a)) + 1)}

print((*sorted(k)))
k = ("a",)
for _ in range(int(eval(input())) - 1):
    k = {a + b for a in k for b in a + chr(ord(max(a)) + 1)}
for i in sorted(k):
    print(i)

k = ("a",)
for _ in range(int(eval(input())) - 1):
    k = {a + b for a in k for b in a + chr(ord(max(a)) + 1)}
print((*sorted(k)))

-for i in sorted(k): -    print(i) +print((*sorted(k)))