import scala.io.StdIn.{readLine, readInt}

object Main extends App {
  var n = readInt
  val arr = readLine.split(" ").map(_.toInt)
  println(arr.mkString(" "))

  for (i <- 1 until n) {
    val e = arr(i)
    var j = i - 1
    while (j >= 0 && arr(j) > e) {
      arr(j + 1) = arr(j)
      j -= 1
    }
    arr(j + 1) = e
    println(arr.mkString(" "))
  }

}
