def trace( nums )
	output = []
	for i in ( 0 ... nums.length )
		output.push( nums[i]  )
		output.push( " " )
	end
	output.pop
	output.push( "\n" )
	print( output.join )
end

n = gets.to_i
nums = gets.split( " " ).map { |val| val.to_i }
trace( nums )

for i in ( 1 ... nums.length )
	key = nums[i]
	j = i - 1
	while 0 <= j && key < nums[j]
		nums[ j+1 ] = nums[j]
		j -= 1
	end
	nums[ j+1 ] = key
	trace( nums )
end