Wiretap Device
Time limit1sMemory limit128 MB
Find the one device whose received power exceeds six times the background noise plus every other device's power, or print NOISE.
Problem
A meeting of programming contest organizers is held in Amsterdam this week. Seongjin, the president of the National Union of University Programming Contest Clubs, wants to eavesdrop on it. He hid wiretap devices near the meeting room. Each device records without stopping and sends what it picks up over radio.
Seongjin handed receivers to union members and spread them across several places. Radio signals interfere with one another, so there can be places where nothing is heard at all. Given the position of one member holding a receiver, write a program that finds the wiretap device that person can hear.
The device audible at a position is the -th device that satisfies the following inequality.
- is the received signal power of the -th device.
- is the strength of the signal sent by the -th device.
- is the position of the -th device.
- is the position of the person holding the receiver.
- is the Euclidean distance between and .
- is the background noise level.
Input
The first line contains the number of test cases. This value does not exceed 100.
The first line of each test case contains the number of wiretap devices (). The second line contains the background noise level (). The third line contains the x coordinate and the y coordinate of the person holding the receiver. Each of the next lines contains the position , of the -th device and its signal strength ().
Every coordinate lies in the interval . Every device position differs from the receiver position . No input is given in which floating point error changes the answer.
Output
For each test case, print the number of the audible wiretap device on its own line. If no device can be heard, print NOISE.
Device numbers start at 1. Two devices can never satisfy the inequality at the same time, so the answer is unique.