By observing the sample we can get this conclusion
First of all edges connected deleted and d, to give a pile section, then rotate the vertex edges of these intervals, and make it connected to d
Repeat the process until we get a bunch length of the interval were 1
Then easily see the above operation flow tree structure constitutes, in addition to the degree of uncertainty of each root point is 2 degrees
Program number is obviously very \ [prod_ {i = 1} ^ {n} {siz (i) \ choose siz (s1), siz (s2) \ dots)} \]
Where \ (s1, s2, \ dots \) represents the i's children
So the difficulty is how to determine the form of a binary tree, and the rest are hard to say, because the rotation only modify a local tree, pushing the multiplication formula multiplies the addition would be finished except
We take a very simple method of divide and conquer, suppose now we have to cut \ ((l, r) \ ) of this section, and then we use a map to point out the existence of each side
Now we need to determine where to split from this interval