Task
You are given a tree with nodes, numbered from to . The edges are numbered from to , and edge has a weight .
Consider a simple path connecting two different nodes. If the weights on this path are (not necessarily in this order), then we define its median as .
Let be the list of medians of all such simple paths (that is, ). What is the th smallest element of ?
Input
The first line contains two integers, and (), (). The -th of the following lines contains three integers , and (), (), corresponding to an edge of weight between nodes and .
For tests worth points, .
For tests worth more points, .
For tests worth points, The tree is a bamboo (no node has a degree greater than ).
Output
The first and only line must contain a single number: the unique integer that solves this task.
Example 1
stdin
3 3
1 2 1
1 3 2
stdout
2
Example 2
stdin
7 15
1 2 3
1 3 1
1 4 4
3 5 1
3 6 5
5 7 9
stdout
3
Explanation
In the first sample case, the elements of in increasing order are 1, 1 and 2.
In the second sample case, the elements of in increasing order are 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 4, 4, 5, 5 and 9.