Bad Signal
There is an important UN meeting in town. Any self-respecting espionage agency will try to eavesdrop on the delegations to gain some advantage in the negotiations. They do this by planting hidden microphones in and around the meeting places. Those microphones continuously capture sound waves and transmit them via radio.
In fact, fierce competition between espionage agencies has left the whole city scattered with hidden microphones, so much so that the radio waves interfere with each other and it is often not even possible to make out any signal in the mess of radio waves – depending on your position and proximity to the different transmitters obviously.
Specifically, it is possible to make out a signal i if and only if:
Where
is the strength of the received signal of microphone i,
s_i is the strength of the signal sent from microphone i,
P_i is the position of microphone i,
P_listen is the position where you are listening to the signals,
|P_i-P_j| is the Euclidean distance between points P_i and P_j and
B is the level of background noise.
Input
On the first line one positive number: the number of test cases, at most 100. After that per test case:
one line with an integer n (0 ≤ n ≤ 100000): the number of planted microphones.
one line with the integer B (0 ≤ B ≤ 1000000): the level of background noise.
one line with two space-separated integers x and y: the x and y coordinates of the location Plisten where you receive the signals.
n lines with three space-separated integers x_i, y_i and s_i (0 < s_{i }≤ 1000000): the x and y coordinates of the location P_i of microphone i and its signal strength, respectively.
All coordinates are in the range [0, 10000]. The locations P_i all differ from P_listen. The test data is constructed so that small floating point rounding errors will not influence the outcome of any solution.
Output
Per test case:
one line with an integer: the (one-based) index of a microphone, the signal of which can be made out, or the string "NOISE" if there is no such microphone.