def array_integer(a)
	0.upto(a.count) {|x|
		a[x] = a[x].to_i
	}
	return a
end

length = STDIN.gets.chomp.to_i
array = array_integer(STDIN.gets.chomp.split(' '))
array = array[0..length-1]

0.upto(length - 2) {|i|
	print array[i], " "
}
print array[length-1], "\n"
	
1.upto(length - 1) {|i|
	v = array[i]
	j = i - 1
	while j >= 0 && array[j] > v do
		array[j+1] = array[j]
		j -= 1
	end
	array[j+1] = v
	0.upto(length - 2) {|i|
		print array[i], " "
	}
	print array[length-1], "\n"
}
