process.stdin.resume();
process.stdin.setEncoding('utf8');
// Your code here!

var lines = [];
var reader = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
});
reader.on('line', (line) => {
    // ここで入力を処理する
    lines.push(line);
});
reader.on('close', () => {
    // ここで出力する
    var a = lines[1].split(" ").map(function(a){return parseInt(a);});
    var n = parseInt(lines[0]);
    
    insertSort(a,n);
});

function insertSort(a, n){
    for (var i = 0;i < n;i++){
        var v = a[i];
        var j = i-1;
        while(j >= 0){
            if (a[j] <= v) break;
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = v;
        console.log(a.join(" "));
    }
}
