# ??????????????\???
length = gets.to_i

# ?????????????´??????\???
A = gets.split(" ").map(&:to_i)

# ?????????????´?????????????
for i in 1..length-1
    # ???????????¶????????¨?????????
    for k in 0..length-2
        print A[k], " "
    end
    print A[k+1], "\n"

    key = A[i]
    # insert A[i] into the sorted sequence A[0..j-1]
    j = i - 1
    while j >= 0 && A[j] > key
        A[j+1] = A[j]
        j = j - 1
    end
    A[j+1] = key
end

# ???????????????????????????????????????????????¶????????¨????????????
for k in 0..length-2
    print A[k], " "
end
print A[k+1], "\n"