Wiretap Device

No attempts yetTime limit1sMemory limit128 MB

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 ii-th device that satisfies the following inequality.

ri>6(B+jirj)r_i > 6 \left( B + \sum_{j \ne i} r_j \right)

  • ri=siPiPlisten2r_i = \dfrac{s_i}{\left| P_i - P_{\mathrm{listen}} \right|^2} is the received signal power of the ii-th device.
  • sis_i is the strength of the signal sent by the ii-th device.
  • PiP_i is the position of the ii-th device.
  • PlistenP_{\mathrm{listen}} is the position of the person holding the receiver.
  • PiPj\left| P_i - P_j \right| is the Euclidean distance between PiP_i and PjP_j.
  • BB 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 nn (0n100,0000 \le n \le 100{,}000). The second line contains the background noise level BB (0B1,000,0000 \le B \le 1{,}000{,}000). The third line contains the x coordinate xx and the y coordinate yy of the person holding the receiver. Each of the next nn lines contains the position xix_i, yiy_i of the ii-th device and its signal strength sis_i (0si1,000,0000 \le s_i \le 1{,}000{,}000).

Every coordinate lies in the interval [0,10000][0, 10000]. Every device position PiP_i differs from the receiver position PlistenP_{\mathrm{listen}}. 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.