var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', function(line) {
  lines.push(line);
});

reader.on('close', function() {
  const N = Number.parseInt(lines[0]);

  var array = new Array(N);
  for (var i = 0; i < N; i++) array[i] = Number.parseInt(lines[1].split(' ')[i]);
  
  insertionSort(array, N);
});

function insertionSort(A, N) {
  console.log(A.join(' '));
  for (var i = 1; i < N; i++) {
    var v = A[i];
    var j = i - 1;
    while (j >= 0 && A[j] > v) {
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    console.log(A.join(' '));
  }
}
