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')
    
    f(a, n).asSequence().map { it.joinToString(separator = "") }.sorted().forEach(::println)
}

fun f(list: List<Char>, n: Int): List<List<Char>> {
    val ret = mutableListOf<List<Char>>()
    if (list.size >= n) {
        ret.add(list)
    } else {
        ('a'..list.last() + 1).map { c -> list.asSequence().plus(c).toList() }.map { f(it, n) }.forEach { ret.addAll(it) }
    }
    return ret
}
