n = gets.to_i
a = gets.split(' ').map(&:to_i)
def sort(a)
  for i in 1..a.size-1
    ans = ""
    count = 1
    a.each do |i|
      ans += "#{i}"
      ans += " " unless count == a.size
      count += 1
    end
    puts ans
    v = a[i]
    j = i - 1
    while j >= 0 && a[j] > v
      a[j+1] = a[j]
      j -= 1
    end
    a[j+1] = v
  end
end

sort(a)
ans = ""
count = 1
a.each do |i|
  ans += "#{i}"
  ans += " " unless count == a.size
  count += 1
end
puts ans