n = gets.to_i
array = gets.split(' ').map {|a| a.to_i }

puts array.join(' ')

for i in 1..n-1
    k = array[i]
    j = i - 1
    while j >= 0 and array[j] > k
        array[j+1] = array[j]
        j = j - 1
    end
    array[j+1] = k
    puts array.join(' ')
end