def insertion_sort(n, as)
  puts as.join(' ')
  i = 1
  while i < n
    j = i
    while j > 0
      if as[j] < as[j - 1]
        a = as[j]
        as[j] = as[j - 1]
        as[j - 1] = a
      end
      j = j - 1
    end
    puts as.join(' ')
    i = i + 1
  end
end

n = STDIN.gets.to_i
as = STDIN.gets.split(' ').map {|x| x.to_i }
insertion_sort(n, as)

