def insertionSort(a,n)
	a.each do|b|
		print b
		print " "
	end
	print "\n"
for i in 1...n
	v = a[i]
	j = i-1
	while j >=0 && a[j] > v
		a[j+1] = a[j]
		j -= 1
	end
	a[j+1] = v
	a.each do|b|
		print b
		print " "
	end
	print "\n"
end
end
	n = gets.to_i
	a = gets.split.map(&:to_i)
insertionSort(a,n)
	