package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 1
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	q := make([]word, 0)
	q = append(q, word{})
	for len(q) > 0 {
		p := q[0]
		if p.i == n {
			break
		}
		q = q[1:]
		m := 0
		for j := 0; j < n; j++ {
			if m < p.data[j] {
				m = p.data[j]
			}
		}
		for i := 0; i <= m+1; i++ {
			w := word{
				i: p.i + 1,
			}
			for j := 0; j < n; j++ {
				w.data[j] = p.data[j]
			}
			w.data[p.i+1] = i
			q = append(q, w)
		}
	}
	used := map[string]bool{}
	for i := 0; i < len(q); i++ {
		a := make([]string, n)
		for j := 0; j < n; j++ {
			a[j] = fmt.Sprintf("%c", 'a'+q[i].data[j])
		}
		aa := strings.Join(a, "")
		if used[aa] {
			continue
		}
		fmt.Fprintln(writer, aa)
		used[aa] = true
	}
}

type word struct {
	i    int
	data [11]int
}
