The first line is an integer(
), which is the number of test cases.
Each test case begins with a line containing two integers,
![]()
The second line The second line contains n space-separated integers v[1], v[2], ..., v[n]--- values of the nodes.
Each of the next n - 1 lines contain two integers u, v, denoting an edge between node u and node v exists in the tree.
It's guaranteed that the given edges form a tree.
For each test case, you should print exactly one line contains n positive integers as answers for all K from 1 to n.
Explanation to the second sample:
K=1,The lili value of node {1,2,3,4,5} is {1,1,1,1,1}
K=2,The lili value of node {1,2,3,4,5} is {1,2,2,1,2}
K=3,The lili value of node {1,2,3,4,5} is {1,2,2,2,3}
K=4,The lili value of node {1,2,3,4,5} is {1,2,2,2,3}
K=5,The lili value of node {1,2,3,4,5} is {1,2,2,2,3}