import scala.io.StdIn._

object Main {
  def main(args: Array[String]) = {
    val n = readInt
    val x = readLine.split(' ').map(a => a.toInt)

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

      println(x.mkString(" "))
    }
  }
}