(function (stdin) {
  const [N, a] = stdin.toString().trim().split("\n");
  const A = a.split(" ").map(Number);
  console.log(A.join(" "));
  for (let idx = 1; idx < N; idx++) {
    const v = A[idx];
    let j = idx - 1;
    while (j >= 0 && A[j] > v) {
      A[j + 1] = A[j];
      j--;
    }
    A[j + 1] = v;
    console.log(A.join(" "));
  }
})(require("fs").readFileSync("/dev/stdin", "UTF-8"));
