var input = '';
var readable = process.stdin;
readable.resume();
readable.setEncoding( 'utf-8' );
readable.on( 'data', function( chunk ) {
  input += chunk;
});

readable.on( 'end', function() {
  var data = input.split( '\n' );
  var n = parseInt( data[0] );
  var nums =  data[1].split( ' ' ).map( Number );
  
  var output = [];
  var i,j;
  output.push( nums.join( ' ' ) );
  for( i=1; i<nums.length; i++ ) {
    var key = nums[i];
    j = i - 1;
    while( 0<= j && key < nums[j] ) {
      nums[j+1] = nums[j];
      j--;
    }
    nums[j+1] = key;
    output.push( nums.join( ' ' ) );
  }
  console.log( output.join( '\n' ) );
});