gets    #trash the first line
arr = gets.split.map(&:to_i)
0.upto(arr.length-1) do |i|
    temp = arr[i]
    j = i-1
    while j >= 0 && arr[j] > temp do
        arr[j+1] = arr[j]
        j -= 1
    end
    arr[j+1] = temp
    puts arr.join(" ")
end