import java.util.Scanner

object Main extends App {

  val n = scala.io.StdIn.readInt()
  val arr = scala.io.StdIn.readLine().split(" ").map(_.toInt)


  def solve() = {
    val default = arr.mkString(" ")
    val ans: Seq[String] = for(i <- 1 until n) yield {
      var v = arr(i)
      var j = i-1
      while(j >= 0 && arr(j) > v) {
        arr(j+1) = arr(j)
        j -= 1
      }
      arr(j+1) = v
      arr.mkString(" ")
    }
    (default +: ans).mkString("\n")
  }

  println(solve)

}

