Cheolsu keeps his left hand wrapped in bandages at all times. Unwrap them and the dark flame dragon breaks loose.
One day a typhoon hit the country where Cheolsu lives. The typhoon drove the dragon far past his control, so Cheolsu decided to leave on a long journey to calm it. Calming the dragon means getting as far away from the typhoon as he can, so he has to travel to the country farthest from the one he lives in.
Cheolsu's world consists of N countries joined by N−1 roads. Each road connects two countries in both directions, and from any country there is a path to every other country. The distance between two countries is the sum of the lengths of the roads on that path.
When Cheolsu lives in country i, let D[i] be the distance to the country his journey ends in. That is, D[i] is the largest distance from country i to another country. Find D[i] for every i with 1≤i≤N.