package main

import (
	"fmt"
)

func dfs(m byte, n int, s []byte) {
	if n == len(s) {
		fmt.Println(string(s))
		return
	}
	for i := byte(0); i < m-'a'+1; i++ {
		s[n] = i + 'a'
		dfs(m, n+1, s)
	}
	s[n] = m + 1
	dfs(m+1, n+1, s)
}

func main() {
	var n int
	fmt.Scan(&n)
	s := make([]byte, n)
	s[0] = 'a'
	dfs('a', 1, s)
}
