- Time limit: 1.00 s
- Memory limit: 512 MB
Uolevi continues his quest to find his long lost uncle. This time he has a strong lead: uncle has been sighted near the town center of Syrjälä. However, as Uolevi arrives to Syrjälä he quickly realizes that the place is so sparsely populated that figuring out where the 'center' isn't an easy task.
Uolevi buys a map of Syrjälä: it has junctions numbered and bidirectional roads connecting them. Road connects junctions and and they are all the same length. There exists a path between every pair of junctions. He figures that the junction that minimizes the average distance to the other junctions is a good place to start searching.
Input
The first line contains two integers and . The -th of next lines contains two integers and .
Output
Print the number of the junction that minimizes the average distance. Formally, find a junction such that minimizes , where is the number of roads on the shortest path between junctions and . If there are multiple answers then print the one with the smallest number.
Constraints
- if
Example 1
Input:
5 7 1 2 1 3 1 4 2 3 2 4 2 5 3 5
Output:
2
Example 2
Input:
10 11 1 2 1 3 1 6 2 7 3 9 4 5 4 10 5 7 5 9 6 8 8 9
Output:
5