def insertion_sort(a, n)
    for i in 1...n do
        puts a.join(" ")
        j = i - 1
        v = a[i]
        while j >=0 && a[j] > v do
            a[j + 1] = a[j]
            j -= 1
        end
        a[j+1] = v
    end
end

n = gets.to_i
a = gets.split.map(&:to_i)

insertion_sort(a, n)
puts a.join(" ")
