fun main(args: Array<String>) {
    val N = nextInt()
    fun dfs(s: String, mx: Char) {
        if (s.length == N) println(s)
        else {
            for (c in 'a' .. mx + 1) {
                dfs(s + c, listOf(c, mx).max()!!)
            }
        }
    }
    dfs("", 'a' - 1)
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
