import scala.collection.mutable


import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    val a = mutable.ArrayBuffer.fill(n)(sc.nextInt())
    println(a.mkString(" "))
    for (i <- 1 to n - 1) {
      val v = a(i)
      var j = i - 1
      while (j >= 0 && a(j) > v) {
        a(j + 1) = a(j)
        j -= 1
        a(j + 1) = v
      }
      println(a.mkString(" "))
    }

  }
}


