function main(input){
    let lines = input.split("\n");
    const int = parseInt;
    const length = int(lines[0]);
    const nums = (lines[1].split(" "));
    
    for(let i=1;i<length;i++){
        let put="";
        for(let k=0;k<length;k++){
            put+=nums[k]+" ";
        }
        console.log(put.trim());
        let current = int(nums[i]);
        let j=i-1;
        while(j>=0 && int(nums[j])>current){
            nums[j+1]=int(nums[j]);
            j--;
            
        }
        nums[j+1]=current;


        
    }
    let put="";
    for(let k=0;k<length;k++){
        put+=nums[k]+" ";
    }
    console.log(put.trim());
    
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
