object Main {
  def main(args: Array[String]): Unit = {
    val input = new java.util.Scanner(System.in)
    val n = input.nextInt
    val a = new Array[Int](n)
    for (i <- 0 until n) {
      a(i) = input.nextInt
    }

    println(a.mkString(" "))

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

  }
}