There is a tree with vertices and
weighted paths. The following operations are required to be supported:
The first line of input contains three positive integers
(
), where
describes the number of operations.
The nextlines each of which contains two positive integers
(
), representing a tree edge.
The nextlines, each line contains three integers
(
), representing a path
with a weight of
. It is guaranteed that the path weights are different from each other.
The nextlines, the first integer of each line
describes the type of the operation.
If, then follows an integer
, which describes the vertex of the query as
.
is the answer of the last query operation, and its initial value is
.
is the XOR symbol. It is guaranteed that
,
.
For each query, output a line with an integer describing the smallest weight.
Outputif all weighted paths that have not been deleted intersect the queried vertex or all paths have been deleted.