Tree
A weighted tree is a tree where each edge is labeled with a number representing the edge's length. All lengths are positive. For each node, you have to find the maximum possible distance to any other node in the tree.
Input
Contains the description of the tree. The first line contains the number of vertices in a tree. Each of the following lines contains the description of the tree's edges. Each edge is described by three positive integers. The first two integers are the labels of the nodes connected by this edge, ranging from to , the third number — the length of the edge. The total length of all edges does not exceed . It is guaranteed that the description of the tree is correct.
Output
Print exactly lines: the -th line contains the distance from node to the most distant node.