function insertionSort(A, N) {
  const leng = N - 1; // 5
  for(let i = 0; i <= leng; i++) {
    let v = A[i];
    let j = i - 1;
    while (j >= 0 && A[j] > v) {
      A[j + 1] = A[j];
      j--;
    }
    A[j + 1] = v;
    console.log(A.join(" "));
  }
}
const lines = require("fs").readFileSync("/dev/stdin", "utf8").split("\n");
const ary = lines[1].split(" ").map(n => Number(n));
insertionSort(ary, lines[0]);


