n = gets.to_i
array = gets.chomp("").split(" ").map(&:to_i)
array.each_with_index do |i,k|
    print " " unless k == 0
    print i 
end
print "\n" 
(1..n-1).each do |i|
    v = array[i]
    j = i - 1
    while j >= 0 && array[j] > v do
        array[j + 1] = array[j]
        j -= 1
    end
    array[j+1] = v
    array.each_with_index do |i,k|
    print " " unless k == 0
    print i 
end
    print "\n" 
end

