In a remote country, there exists a unique network of libraries connected by roads. The network has some special characteristics:
The country's Ministry of Education wants to optimize their book-sharing system across these libraries. To optimize this system, they wants to know, for each library, the sum of the distances from the library to all other libraries. This information will help them place the most frequently accessed books in the most accessible locations (those with smaller total distances), while rarely requested books can be stored in the libraries far from the center (those with larger total distances).
Your task is help them find the distances.
The first input line contains an integer n: the number of libraries. The libraries are numbered from $1$ to $n$
Then there are $n-1$ lines describing the roads that connects two libraries. Each line contains two integers $a_i$ and $b_i$: there is an road connecting library $a_i$ and $b_i$.
Print $n$ integers: for each library 1, 2, $\ldots$ , $n$, the sum of the distances.
Noted that you should output one single line.