문제
Farmer John's
Instead of mooing at each-other over long distances, the cows decide to equip themselves with walkie-talkies, one for each cow. These walkie-talkies each have a limited transmission radius, but cows can relay messages to one-another along a path consisting of several hops, so it is not necessary for every cow to be able to transmit directly to every other cow.
The cows need to decide how much money to spend on their walkie-talkies. If they spend $X, they will each get a walkie-talkie capable of transmitting up to a distance of
Please help the cows determine the minimum integer value of
Problem credits: Richard Peng
입력
The first line of input contains
The next
출력
Write a single line of output containing the integer
예제
4
1 3
5 4
7 2
6 1
17