The first line contains an integer n (1≤n≤2⋅10^5) indicating the number of nodes in the tree.
The second line contains n integers, and the i-th integer ai (0≤ai≤10^9) indicates the original value of the i-th node.
Each of the next (n−1) lines contains two integers u and v, indicating an edge between u and v.