def show_ary a,n
  for i in 0..n-1
    print " " unless i == 0
    print a[i]
  end
  print "\n"
end

n = gets.to_i
a = gets.split.map {|s| s.to_i}
show_ary a,n
for i in 1..n-1
  k = a[i]
  j = i-1
  while j >= 0 && a[j] > k
    a[j+1] = a[j]
    j -= 1
  end
  a[j+1] = k
  show_ary a,n
end