import java.util.*

fun main(args: Array<String>) {
    val result = solve(Scanner(System.`in`))
    if (result.isNotEmpty()) println(result)
}

fun solve(`in`: String) = solve(Scanner(`in`))


fun solve(sc: Scanner): String {
    val N = sc.nextInt()

    val result = mutableListOf<String>()
    fun f(n: Int, s: String) {
        if (n == N) {
            result.add(s)
            return
        }
        ('a'..(s.max()!! + 1)).forEach {
            f(n + 1, s + it)
        }
    }
    f(1, "a")

    return result.joinToString("\n")
}
