function main(input) {

  let list = input.split("\n")[1].split(' ').map(x => parseInt(x));
  console.log(list.join(" "));
  for (let i = 1; i < list.length; i++) {
    let v = list[i];
    let j = i - 1;

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