n = gets.to_i
as = gets.split.map(&:to_i)
ans = [as]
bs = as

(1...n).each do |i|
  bs = bs.dup
  v = bs[i]
  j = i - 1

  while j >= 0 && bs[j] > v
    bs[j + 1] = bs[j]
    j -= 1
  end

  bs[j + 1] = v
  ans << bs
end

ans.each do |i|
  puts i.join(' ')
end

