fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val ans = mutableListOf<String>()

    fun rec(s: String, cur: Int) {
        if (cur == n) {
            ans.add(s)
            return
        }
        for (i in 0..(s.max()!! - 'a' + 1)) {
            rec(s.plus(('a' + i)), cur + 1)
        }
    }

    rec("a", 1)

    println(ans.sorted().joinToString("\n"))
}
