# Your code here!
def putList(l)
    print l[0]
    for i in 1...l.length do
        print " "
        print l[i]
    end
    print "\n"
end

def sort(l)
    for i in 1...l.length do
        v = l[i]
        j = i - 1
        while (j >= 0 && l[j].to_i > v.to_i) do
            l[j+1] = l[j]
            j -= 1
        end 
        l[j+1] = v
        putList(l)
    end
end

n = gets
line = gets
list = line.split(" ")

putList(list)
sort(list)

