Small tree problem

In a weighted tree, how to find for every node the other node farthest from it (in linear time)?

Thanks