import java.util.*

fun main(args: Array<String>) {
    val values = mutableListOf<Int>()
    val scanner = Scanner(System.`in`)

    val n = scanner.nextLine().toInt()
    repeat(n) { values.add(scanner.nextInt()) }

    var v: Int
    var j: Int
    (1 until n).forEach { i ->
        println(values.joinToString(" "))
        v = values[i]
        j = i - 1
        while (j >= 0 && values[j] > v) {
            values[j + 1] = values[j]
            j--
        }
        values[j + 1] = v
    }
    println(values.joinToString(" "))
}
