len = gets.chomp.to_i
arr = gets.chomp.split(' ').map(&:to_i)

ans = []
ans << arr.join(' ')
if len != 1
  (1..(len-1)).each do |i|
    j = i-1
    o = arr[i]
    while j >= 0 && arr[j] > o
      arr[j+1] = arr[j]
      j -= 1
    end
    arr[j+1] = o
    ans << arr.join(' ')
  end
end
puts ans.join("\n")
