n = gets.to_i
arr = gets.chomp.split.map(&:to_i)

def puts_arr(arr)
  puts arr.join(' ')
end

def insertionSort(arr, n)
  1.upto(n-1) do |i|
    v = arr[i]
    j = i-1
    while j>=0 && arr[j] > v
      arr[j+1] = arr[j]
      j -= 1
    end
    arr[j+1] = v
    puts_arr(arr)
  end
end

insertionSort(arr, n)