The first line contains N, M, and C separated by spaces. N is the number of vertices, M is the number of queries, and C is the number of distinct colors, with 1≤N≤2×105, 1≤M≤2×105, and 1≤C≤N.
The second line contains N integers separated by spaces. The i-th integer is the color of vertex i, and each value is between 1 and C inclusive.
Each of the following N−1 lines describes an edge of the tree. Each line contains two distinct vertex numbers u and v separated by a space, with 1≤u,v≤N.
Each of the following M lines describes a query. The i-th line contains vi and ci separated by a space, with 1≤vi≤N and 1≤ci≤C.