#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A&lang=jp

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


(0..n-1).each do |i|
    v = a[i]
    j = i-1
    
    while j>=0 && a[j]>v do
        a[j+1] = a[j]
        j-=1
    end

    a[j+1]=v
    
    puts a.join(" ")
end