var input = require('fs').readFileSync('/dev/stdin', 'utf8');
input = input.split("\n");
var A = input[1].split(" ").map(function(e){ return parseInt(e,10)});

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

