N = int(input())

alphabet = [chr(97+i) for i in range(min(N,26))]
# print(alphabet)

dp = [[None]*N for _ in range(N)]
dp[0][0] = [alphabet[0]]
for i in range(1,N):
	dp[0][i] = []
# print(dp)


for n in range(1,N):
	for k in range(N):
		# dp[n][k] = dp[n-1][k]*k + dp[n-1][k-1]
		dp[n][k] = []
		for s in dp[n-1][k]:
			# print([s + alphabet[i] for i in range(k+1)])
			dp[n][k] += [s + alphabet[i] for i in range(k+1)]
		for s in dp[n-1][k-1]:
			dp[n][k] += [s + alphabet[k]]

# print(dp)

for k in range(N):
	# print(k, dp[N-1][k])
	for ans in sorted(dp[N-1][k]):
		if len(ans)!=0:
			print(ans)
		