n = gets.to_i
A = gets.split(" ").map &:to_i

for i in 0..n-1
    tmp = A[i]
    j = i - 1
    while j >= 0 and A[j] > tmp do
        A[j+1] = A[j]
        j -= 1
    end
    A[j+1] = tmp
    for j in 0..n-1
        if j != 0 then
            print(" ")
        end
        print(A[j])
    end
    print("\n")
end


