Railway
In the country of Olympia, an economic crisis has impacted the local railway system. Following recent reforms, Olympia's railway network consists of N stations connected by N-1 tracks. Each station can be directly linked to no more than six other stations. There is a unique path between any two stations.
The railway's biggest challenge is theft, as thieves dismantle tracks at night. They can start from any station and move to any other station without restriction, but they cannot pass through the same station more than once.
The railway management needs your help to determine the maximum potential damage and the number of ways to achieve it.
Input
The input begins with an integer N (1 ≤ N ≤ 100000), representing the number of railway stations. This is followed by N-1 triples of integers. Each triple describes a track, with the first two numbers indicating the station numbers connected by the track, and the third number representing the track's length in kilometers (with a maximum length of 1000 km).
Output
The output should consist of two numbers separated by a space: the maximum possible damage (the total length of tracks that thieves can dismantle) and the number of ways to achieve this damage.