The first line of the input contains an integer T( T<= 10 ), indicating the number of test cases.
For each test case, the first line contains only one integers n, indicating the number of cities.
The next n lines, each line contains three integers fi, pi, ri, where fi is the number of his friend living in city i, pi is the price of each gift in city i, ri is the packing cost in the city i.
The next of n-1 lines, each line contains two integers ui and vi, indicating that the traveler can go to vi from ui or go to ui from vi.
You can assume 1<=n<=4*105, 1<=fi<=104, 1<=pi,ri<=105, 1<=ui,vi<=n