def alds11a
    n = gets.chomp.to_i
    an = gets.chomp.split(/\s/).map{|x| x.to_i}

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

    puts an.join(' ')
end

alds11a
