process.stdin.resume();
process.stdin.setEncoding("utf8");

const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});

const lines = [];

reader.on("line", (line) => {
  lines.push(line);
});

reader.on("close", () => {
  let n = lines[0] - 0;
  let ns = lines[1].split(" ").map(Number);
  console.log(lines[1]);
  for (let i = 1; i < n; i++) {
    for (let j = i; j > 0; j--) {
      if (ns[j] < ns[j - 1]) {
        const t = ns[j];
        ns[j] = ns[j - 1];
        ns[j - 1] = t;
      } else {
        break;
      }
    }
    console.log(ns.join(" "));
  }
});

