import scala.io.StdIn
object Main {
    def main(args: Array[String]): Unit = {
        val len = StdIn.readInt()
        val arr = StdIn.readLine().split(" ").map(_.toInt)
       insertionSort(len, arr)
    }
    def insertionSort(len: Int, arr: Array[Int]) = {
        for (seek <- (1 until len)) {
            val v = arr(seek)
            var ptr = seek - 1
            while (ptr >= 0 && arr(ptr) > v) {
                arr(ptr + 1) = arr(ptr)
                ptr -= 1
            }
            arr(ptr + 1) = v
            println(arr.mkString(" "))
        }
    }
}
