object Main extends App {
  import java.{ util => ju }
  import scala.annotation._
  import scala.collection._
  import scala.collection.{ mutable => mu }
  import scala.collection.JavaConverters._
  import scala.math._
  import scala.io.StdIn.readLine

  val sc = new ju.Scanner(System.in)

  val n = sc.nextInt()
  var nums = Array.fill(n)(sc.nextInt())

  for (i <- 0 until n) {
    val v = nums(i)
    var j = i - 1
    while (j >= 0 && v < nums(j)) {
      nums(j + 1) = nums(j)
      nums(j) = v
      j -= 1
    }
    printArray(nums)
  }

  def printArray(nums: Array[Int]) {
    for (i <- 0 until nums.length - 1) print(nums(i) + " ")
    println(nums.last)
  }
}