n = gets.chomp
input = gets.split(" ").map{|ele| ele.to_i}
def insertSort(array)
	array.each_with_index do |ele1,i|
		array[0..i].each_with_index do |ele2,j|
			if ele1 < ele2 then
				array.delete_at( i )
				array.insert( j , ele1 )
				break
			end
		end
	p array
	end
end

def p(array)
	array.each do |ele|
		putc ele.to_s
		putc " " 
	end
	puts ""
end
insertSort(input)