object Main {
  def main(args: Array[String]): Unit = {
    val scanner = new java.util.Scanner(System.in)

    val n = scanner.nextInt
    val a = Array.fill(n)(scanner.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(" "))
    }
  }
}

