Byteasar is preparing a problem for a programming contest. He has already written a draft of the statement.
Byteotia has n cities joined by n−1 two-way roads, laid out so that the road network lets you travel between any two cities. Driving the road between two directly connected cities takes one hour. The cities are numbered from 1 to n, and ai inhabitants live in city i.
An election is held in Byteotia next year. To keep full control over the vote, the king of Byteotia decided that the vote takes place in a single city. Every inhabitant of Byteotia travels to the city with the ballot box along a shortest route and votes there. All that is left is to choose the city that holds the vote, and this choice depends on many factors. In particular, for every city i we want to compute the total time all inhabitants of Byteotia need to reach city i. Call this value bi. [...]
Byteasar had already prepared unusually hard tests for the problem, but he accidentally lost half of the data. All that is left of each test is the part describing the roads and the output file with the values bi. From that alone Byteasar wants to recover the number of inhabitants of every city of Byteotia.
The first line contains an integer n (2≤n≤300000), the number of cities in Byteotia. Each of the next n−1 lines contains two integers xi, yi (1≤xi,yi≤n) describing one road, which means that city xi and city yi are joined by a road. The road network connects all cities.
The next line contains a sequence of n integers bi (0≤bi≤109).
Print a sequence of n integers ai on one line, separated by single spaces. The number ai is the number of inhabitants of city i of Byteotia. Solving Byteasar's problem for the printed sequence ai has to give back the sequence bi from the input.
The input always admits an answer. Once the road network and the sequence bi are fixed, only one sequence ai satisfies the condition, so print that sequence.