- Time limit: 1.00 s
- Memory limit: 512 MB
You are given a tree consisting of nodes. The nodes are numbered . Each node has a value.
Your task is to process following types of queries:
- change the value of node to
- find the maximum value on the path between nodes and .
Input
The first input line contains two integers and : the number of nodes and queries. The nodes are numbered .
The next line has integers : the value of each node.
Then there are lines describing the edges. Each line contains two integers and : there is an edge between nodes and .
Finally, there are lines describing the queries. Each query is either of the form "1 " or "2 ".
Output
Print the answer to each query of type 2.
Constraints
Example
Input:
5 3 2 4 1 3 3 1 2 1 3 2 4 2 5 2 3 5 1 2 2 2 3 5
Output:
4 3