Bogdan has a birthday today and mom gave him a tree consisting of
n vertecies. For every edge of the tree
i, some number
xi was written on it. In case you forget, a tree is a connected non-directed graph without cycles. After the present was granted,
m guests consecutively come to Bogdan's party. When the
i-th guest comes, he performs exactly one of the two possible operations:
-
Chooses some number yi, and two vertecies ai and bi. After that, he moves along the edges of the tree from vertex ai to vertex bi using the shortest path (of course, such a path is unique in the tree). Every time he moves along some edge j, he replaces his current number yi by , that is, by the result of integer division yi div xj.
-
Chooses some edge pi and replaces the value written in it xpi by some positive integer ci<xpi.
As Bogdan cares about his guests, he decided to ease the process. Write a program that performs all the operations requested by guests and outputs the resulting value
yi for each
i of the first type.
Output
For each guest who chooses the operation of the first type, print the result of processing the value
yi through the path from
ai to
bi.
Note
Initially the tree looks like this:
The response to the first query is:
= 2
After the third edge is changed, the tree looks like this:
The response to the second query is:
= 4
In the third query the initial and final vertex coincide, that is, the answer will be the initial number 20.
After the change in the fourth edge the tree looks like this:
In the last query the answer will be:
= 3