From XOR with love
Again XOR, again query, again tree — романтика (с) Ануар Сериков
Where XOR there is no place for words. So, let's move on with problem.
Given a rooted tree with vertices, all vertices numbered from up to . Each vertex of the tree has a single number written on it, value of vertex. The root of the tree is vertex .
In this problem you must process queries. Each query is one the following 2 types:
— change all numbers written on the vertices of the subtree of the vertex , i.e. if the number written on some vertex is , substitute it with .
— print the minimum of the numbers written on the vertices of the simple path from the vertex to the vertex , i.e. more formally let's numbers on path from vertex to vertex will be , then the answer to this query is minimum in this sequence.
Input
The first line contains two integers — the number of vertices in the tree, and is the number of queries.
The second line contains a sequence of integers — the numbers written on vertices.
Then follow lines, describing the tree edges. Each line contains a pair of integers — the vertices connected by an edge, it's guaranteed that graph is a connected tree.
The last lines describe the queries. The first number on -th line is — the type of the -th query. If , then follows two integers and , , otherwise it follows with two integer numbers and . All input numbers are integers.
Output
For each query of 2nd type print one integer — the answer to the query, each answer on a separate line.
Examples
is an exclusive OR, e.g. .