def insertionSort(a, n)
  puts a.join(' ')
  for i in 1..(n-1)
    v = a[i]
    j = i - 1
    while j >= 0 && a[j] > v
      a[j+1] = a[j]
      j -= 1
      a[j+1] = v
    end
    puts a.join(' ')
  end
end

input = []
2.times do |i|
  input[i] = gets
end
n = input[0].to_i
a = input[1].split(' ').map(&:to_i)
insertionSort(a, n)