eolymp
bolt
Try our new interface for solving problems
Problems

Bad Signal

Bad Signal

Time limit 1 second
Memory limit 122 MiB

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 data

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 data

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.

Examples

Input example #1
3
4
10
100 100
90 90 20000
110 90 50
90 110 1000
110 110 50
4
100
100 100
90 90 20000
110 90 50
90 110 1000
110 110 50
2
0
0 10
0 0 1000
0 8 1
Output example #1
1
NOISE
1
Source 2013 Benelux Algorithm Programming Contest (BAPC), Preliminaries, September 28, Problem B