import java.util.*

fun insertionSort(A: Array<Int>, N: Int) {
    println(A.joinToString(" "))
    for (i in 1 until N) {
        val v = A[i]
        var j = i - 1
        while (j >= 0 && A[j] > v) {
            A[j + 1] = A[j]
            j--
        }
        A[j + 1] = v
        println(A.joinToString(" "))
    }
}

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val N = scanner.nextInt()
    val list = mutableListOf<Int>()
    (1..N).forEach {
        list.add(scanner.nextInt())
    }
    insertionSort(list.toTypedArray(), N)
}
