function main(input){
  let lines = input.split("\n");
  let N = lines[0];
  let A = lines[1].split(" ");
  console.log(lines[1]);
  for(let i = 1; i <= A.length - 1;i++){
    let v = Number(A[i]);
    let j = i - 1;
    while(j >=0 && A[j] > v){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    console.log(A.join(" "))
  }
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
