package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	standards := make(map[int][]string, 0)
	standards[1] = append(standards[1], "a")
	for i := 2; i <= n; i++ {
		for k, standard := range standards[i-1] {
			if i > 3 && k == 0 {
				for j := 0; j < i-2; j++ {
					c := 'a' + j
					standards[i] = append(standards[i], standard+string(c))
				}
			} else {
				for j := 0; j < i-1; j++ {
					c := 'a' + j
					standards[i] = append(standards[i], standard+string(c))
				}
			}
		}
		standards[i] = append(standards[i], standards[i-1][len(standards[i-1])-1]+string('a'+i-1))
	}
	for _, v := range standards[n] {
		fmt.Println(v)
	}
}
