import scala.io.StdIn.{readInt, readLine};

object Main {
    def main(args: Array[String]): Unit = {
        val n = readInt();
        val arr = readLine().split(" ").map(_.toInt);
        sort(arr);
    }
    def sort(arr: Array[Int]): Unit = {
        for (i <- 0 until arr.length) {
            val v = arr(i);
            var j = i - 1;
            while (j >= 0 && v < arr(j)) {
                arr(j + 1) = arr(j);
                j -= 1;
            }
            arr(j + 1) = v;
            println(arr.mkString(" "));
        }
    }
}
