import java.util.*

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

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

    ('a' .. m).forEach {
        a.add(it)
        go(current + 1, a, m, n, out)
        a.removeAt(a.lastIndex)
    }
    a.add(m + 1)
    go(current + 1, a, m + 1, n, out)
    a.removeAt(a.lastIndex)
}