let content = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', buf => {
  content += buf;
});

process.stdin.on('end', () => {
  let [, nums] = content
    .trim()
    .split('\n')
    .map(line => line.split(' ').map(n => +n));
  insertionSort(nums);
});

const insertionSort = nums => {
  console.log(nums.join(' '));
  for (let i = 1; i < nums.length; i++) {
    const v = nums[i];
    j = i - 1;
    while (j >= 0 && nums[j] > v) {
      nums[j + 1] = nums[j];
      j--;
    }
    nums[j + 1] = v;
    console.log(nums.join(' '));
  }
};
