You are given a connected undirected graph with an even number of nodes. A connected graph is a graph in which all nodes are connected directly or indirectly by edges.
Your task is to find a spanning tree whose median value of the edges' costs is minimum. A spanning tree of a graph is a tree that contains all nodes of the graph.
The input consists of multiple datasets.
The format of each dataset is as follows:
s_1\ t_1\ c_1
s_m\ t_m\ c_m
The first line contains an even number (2 \leq n \leq 1000) and an integer (n-1 \leq m \leq 10000). is the number of nodes and is the number of edges in the graph.
Then lines follow, each of which contains s_i (1 \leq s_i \leq n), t_i (1 \leq t_i \leq n, t_i \neq s_i), and c_i (1 \leq c_i \leq 1000).
This means there is an edge between nodes s_i and t_i, and its cost is c_i. There is no more than one edge that connects s_i and t_i.
The input terminates when n = 0 and m = 0. Your program must not output anything for this case.
Print the median value in a line for each dataset.
Example 1