let inputString;

process.stdin.on('data', (input) => {
  inputString += input;
});

process.stdin.on('end', () => {
  const inputArr = inputString.split('\n');
  insertionSort(inputArr[1].split(' ').map((str) => Number(str)));
});

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