package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanRunes() []rune { return []rune(scanString()) }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()

	// ans := make([][]rune,0)
	var fn func(idx,ma int, a []int)
	fn = func(idx, ma int, a []int) {
		if idx == n {
			r := make([]rune, n)
			for i := 0; i < n; i++ {
				r[i] = rune(a[i]+'a')
			}
			fmt.Fprintln(wr, string(r))
			// fmt.Fprintln(wr, a)
			return
		}

		for i := 0; i < ma+1; i++ {
			a[idx] = i
			fn(idx+1, i+1,a)
		}
	}

	arr := make([]int, n)
	fn(0,0,arr)
}
