프로그램 명: ncpc_flight(special jduge)
제한시간: 1 초
//sj가 아직....

The airline company NCPC Airways has ights to and from n cities, numbered from 1 to n, around the entire world. However, they only have n - 1 different ights (operating in both directions), so in order to travel between any two cities you might have to take several ights.

In fact, since the management has made sure that it's possible to travel between any pair of cities, there is exactly one set of ights a passenger have to take in order to travel between two cities (assuming you want to use the same airline).

Recently many of NCPC Airways frequent yers have complained that they have had to change ights too often to get to their final destination. Since NCPC Airways doesn't want to loose their customers to other airline companies, but still keep the nice property of their ights, they have decided to cancel one of their current ights and replace it with another ight.

Help the company by writing a program which finds the best ight to cancel and the best new ight to add so that the maximum number of ight changes a passenger might have to make when travelling between any pair of cities in which NCPC Airways operates is minimized.

The input will be constructed so that it is always possible to improve the maximum number of ight changes needed.

입력

출력

The output should consist of three lines.

If there are more than one optimal solution, any one of them will be accepted.

입출력 예

입력

4
1 2
2 3
3 4

출력

2
3 4
2 4

입력

14
1 2
1 8
2 3
2 4
8 9
8 10
8 11
4 5
4 6
4 7
10 12
10 13
13 14

출력

5
1 8
2 10
출처:ncpc/2009/Problem G

[질/답] [제출 현황] [푼 후(0)]
[ 채 점 ] [홈으로]  [뒤 로]