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

object Main extends App {
  val n = readInt
  val a = readLine.split(" ").map(_.toInt)

  var j = 0
  for(i<-1 until a.length) {
    val key = a(i)
    j = i-1
    while( j >= 0 && a(j) > key ) {
      a(j+1) = a(j)
      j -= 1
    }
    a(j+1) = key

    println(a.mkString(" "))
  }
}