import java.util.*

val out = ArrayList<String>()
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = ArrayList<Char>()
    a.add('a')
    go(1, a, 'a', n)
    println(out.joinToString("\n"))
}

fun go(current: Int, a: ArrayList<Char>, m: Char, n: Int) {
    if (a.size == n) {
        out.add(a.joinToString(""))
        return
    }

    val next: Char = a.last() + 1
    ('a' .. m).forEach {
        a.add(it)
        go(current + 1, a, m, n)
        a.removeAt(a.lastIndex)
    }
    a.add(m + 1)
    go(current + 1, a, m + 1, n)
    a.removeAt(a.lastIndex)
}