input_line = []

while line = gets
  input_line << line.chomp
end

n = input_line.shift.to_i

A = input_line.shift.split(" ").map(&:to_i)

puts A.join(" ")
1.upto(A.length-1) do |i|
  key = A[i]
  j = i - 1
  while j >= 0 && A[j] > key do
    A[j+1] = A[j]
    j -= 1
    A[j+1] = key
  end
  puts A.join(" ")
end