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

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 = j-1
    A[j+1] = v
  end
  puts A.join(" ")
end