n = int(input())
def f(l):
	return "".join([chr(x+97) for x in l])

a = [0 for _ in range(n)]
print(f(a))

while a != list(range(n)):
	for i in range(n-1, 0, -1):
		if a[i-1] >= a[i]:
			a[i] += 1
			for j in range(i+1, n):
				a[j] = 0
			print(f(a))
			break