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)
	output=""
	array.each do |ele|
		output = output + ele.to_s + " "
	end
	output[-1] = ""
	puts output
end
insertSort(input)