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

N = gets.strip.to_i
a = gets.strip.split(" ").map{|i| i.to_i}
puts a.join(" ")
insertionSort(a, N)
