**Filthy Rich Trees SOLUTION Codeforces**

**Filthy Rich Trees SOLUTION Codeforces**

You may have heard the expression “cash doesn’t fall from the sky.” Obviously, whoever thought of it smelled at both plant science and programming. You’ve discovered that making trees which develop foul measures of cash is inconsequential to the point, that it’s left as an activity to the peruser. Time for the genuine test: benefitting off your creation!

You have established your cash tree at hub 1, and every hub has a predetermined moola esteem. The measure of cash that some subtree established at hub x will create is equivalent to the result of the moola estimations of all hubs in x’s subtree. At first, all hubs will have a moola estimation of 1.

Presently, q times, one of two things occur, given to you as “t x y”:

On the off chance that t=1, you give hub x an extraordinary compost which sets its moola incentive to y.

On the off chance that t=2, a client comes in and asks “how often more significant is subtree x than subtree y”? Officially, what is the estimation of subtree x isolated by the estimation of subtree y. Likewise, you don’t care for printing gigantic numbers, so subtree x is in excess of multiple times more prominent than subtree y, just print “1000000000”.

Information

The primary line will contain a solitary number n, the quantity of hubs in the tree. n−1 lines follow, each containing two distinct numbers, depicting the edges of the tree. Extra requirement on input: these edges will shape a tree.

After that there will be a solitary whole number q: the quantity of inquiries. q line follow, every one of the structure txy, as portrayed previously.

1≤n,q≤3∗105

1≤t≤2

1≤x,y≤n

Yield

For each inquiry of type 2, print a solitary line with one genuine number: how frequently more important subtree x is than subtree y. Be that as it may, on the off chance that this worth is >= 109, at that point print only 1000000000.

Your answer will be acknowledged whether your responses to all inquiries have total or relative blunder of all things considered 10−6.

Models

inputCopy

1

1

1

outputCopy

inputCopy

3

3 2

2 1

3

2

2 1 2

2 3

outputCopy

1.0000000000

1.0000000000

1.0000000000

inputCopy

5

4 2

1 4

5 4

3 4

5

2 5 2

1 5 4

1 5

1 5 4

2 5 4

outputCopy

1.0000000000

1.0000000000