import java.util.Scanner

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val array = IntArray(n){sc.nextInt()}
  for (i in 1 until array.size) {
    println(array.joinToString(" "))
    val v = array[i]
    var j = i - 1
    while (j >= 0 && array[j] > v) {
      array[j+1] = array[j]
      j--
    }
    array[j+1] = v
  }
  println(array.joinToString(" "))
}
