(function (chunk) {
    var line = chunk.split("\n");
    var N = Number(line[0]);
    var A = line[1].split(/ /).map(Number);
    
    console.log(A.join(" "));
    
    // insertion sort
    var i, v, j;
    for (i = 1; i < N; 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(" "));
    }
})(require('fs').readFileSync('/dev/stdin', 'utf8'));