package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc *bufio.Scanner
var out *bufio.Writer

func main() {
	sc = bufio.NewScanner(os.Stdin)
	//bytes, _ := ioutil.ReadFile("./stdin.txt")
	//sc = bufio.NewScanner(strings.NewReader(string(bytes)))
	out = bufio.NewWriter(os.Stdout)
	buf := make([]byte, 1<<20)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	n := nextInt()

	dic := []string{}
	f(&dic, 0, n, make([]byte, n), 'a', map[string]bool{})
	sort.Sort(sort.StringSlice(dic))

	for _, str := range dic {
		fmt.Fprintln(out, str)
	}
}

func f(list *[]string, i, n int, s []byte, c byte, v map[string]bool) {
	s[i] = c
	if i == n-1 {
		str := string(append([]byte{}, s...))
		if _, ok := v[str]; !ok {
			*list = append(*list, str)
			v[str] = true
		}
		return
	}

	for j := i + 1; j < n; j++ {
		f(list, j, n, s, c, v)
		f(list, j, n, s, c+1, v)
	}
}

func next() string {
	sc.Scan()
	return sc.Text()
}
func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}
func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func intMin(a, b int) int {
	if a > b {
		return b
	}
	return a
}
func intMax(a, b int) int {
	if a > b {
		return a
	}
	return b
}
