import java.math.BigInteger
import java.util.*

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map(String::toInt) // list of ints
private fun readLongs() = readStrings().map(String::toLong) // list of longs

fun main(args: Array<String>) {
    val n = readInt()
    val a = listOf('a')
    var max = 'a'

    var r = mutableListOf<String>()

    fun f(list: List<Char>, m: Char) {
        if (m == 'a' + n) {
            r.add(list.asSequence().joinToString(separator = ""))
            return
        }

        ('a'..list.last() + 1).map { c -> list.asSequence().plus(c).toList() }.forEach { f(it, m + 1) }
    }

    f(a, max + 1)

    print(r.joinToString(separator = "\r\n"))
}