const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const lines = input.split("\n");
const n = Number(lines[0]);
const ary = lines[1].split(" ").map(Number);
let i, j, v;

console.log(ary.join(" "));
for (i = 1; i < n; i++) {
	v = ary[i];
	j = i - 1;
	while (j >= 0 && ary[j] > v) {
		ary[j + 1] = ary[j];
		j--;
	}
	ary[j + 1] = v;
	console.log(ary.join(" "));
}
