package main

import (
	"fmt"
	"sort"
)

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

	ss := make([]string, 0)
	var dfs func(s string)
	dfs = func(s string) {
		if len(s) == n {
			ss = append(ss, s)
			return
		}

		x := s[len(s)-1] - 'a'
		for i := 0; i <= int(x)+1; i++ {
			dfs(s + string('a'+i))
		}
	}
	dfs("a")

	sort.Strings(ss)

	for i := 0; i < len(ss); i++ {
		fmt.Println(ss[i])
	}
}
