function main(_stdin){
    const stdin = _stdin.split('\n');
    const length = parseInt(stdin.shift(), 10);
    const series = stdin.shift().split(' ').map(e => parseInt(e, 10));

    console.log(series.join(' '));
    for (let i = 1, l = length; i < l; i++) {
        const t = series[i];
        let j = i - 1;

        while(j >= 0 && series[j] > t){
            series[j+1] = series[j];
            j--;
        }
        series[j+1] = t;
        console.log(series.join(' '));
    }
}
// main(require("fs").readFileSync("./ALDS1_1_A", "utf8"));
main(require("fs").readFileSync("/dev/stdin", "utf8"));


