class Array
	def insertion_sort(n)
		copy = self
		puts copy.map(&:to_s).join(" ")
		for i in 1..n-1
			tmp = copy[i]
			if copy[i-1] > tmp
				j = i
				begin
					copy[j] = copy[j-1]
					j = j - 1
				end while j > 0 && copy[j-1] > tmp
				copy[j] = tmp;
			end
			puts copy.map(&:to_s).join(" ")
		end
	end
end


N = gets.to_i
arr = gets.split.map(&:to_i)
arr.insertion_sort(N)