function main(input) {
    new Main(input).walk();   
}
  
var input = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
    input += chunk;
});
process.stdin.on('end', function() {
    main(input);
});
var tmp = `6
5 2 4 6 1 3`
class Main{
    constructor(input){
        var splits = input.split("\n");
        this.N = Number(splits[0]);
        this.list = splits[1].split(" ").map(v=>Number(v));
    }
    walk(){
        for(var i=1; i < this.N; i++){
            console.log(this.list.join(" "));
            var v = this.list[i];
            var j = i - 1;
            while(j >= 0 && this.list[j] > v){
                this.list[j+1] = this.list[j]
                j--;
            }
            this.list[j+1] = v;
        }
        console.log(this.list.join(" "));
    }
}
// new Main(tmp).walk();
