A sensor network consists of a set of n sensors s1, s2,..., sn. All the sensors are placed in a two dimensional plane and will never be moved again. Thus, each sensor si has a fixed coordinates (xi, yi).
A pair of sensors si and sj can communicate by sending messages. Suppose that si wants to send a message directly to sj, a fixed amount of electrical power pi, j is required at si. In real world situation, the value of pi, j depends on many factors. For simplicity we assume that the value of pi, j depends only on the distance between the communicating sensors. In this problem, we assume that
Furthermore, we assume that only the sender needs to consume this amount of power in the communication.
Since the power stored in each sensor is a precious resource, sending message directly to the destination sensor may consume too much electrical power for a sensor. In this problem, we want to find an optimal path to send a message from si to sj such that the maximum power required by the sensors on the path is minimized.
More formally, let P be a valid path from si to sj. Let k1 = i, k2,..., kr = j be the sequence of the indexes of the sensors along the path P. Define the weight of P by
A path P is an optimal path from si to sj if its weight w(P) is minimized among all paths from si to sj.
Given a sensor network G, the sender si and the receiver sj, write a program to compute an optimal path from si to sj for sending a message.
An instance of the problem consists of
These data are stored in
n/20
+ 2 lines in the input file.
In this problem, we assume that 1 < n < 1000, xi and yi are integers and 0
xi, yi < 215.
Note that the test data file may contain more than one instances. The last instance is followed by a line containing a single `0'.
The output for each test case is an integer w which is the maximum power required along the optimal path from si to sj.