In a certain 2D kingdom, there exist ~B~ beacons, numbered ~1 \ldots B~.
Since they were built at different times during the kingdom's history, they were not all constructed under the same specifications. As such, certain beacons may be brighter than others. A beacon ~i~'s range ~r_i~ is defined as the radius around the beacon's location ~(x_i, y_i)~ inside which the light from the beacon is visible.
Initially, all beacons are unlit. In the case of an invasion, a beacon will be lit, and the light from it will signal all beacons within its range (including beacons just barely within its range) to light as well. In this way, news of the invasion will propagate throughout the entire kingdom efficiently.
Or at least, that's what's supposed to happen. However, due to the haphazard way in which the beacon network was built, it may not function as intended. That is, some beacons or groups of beacons may be separated from each other, so that a signal may not be physically able propagate through the entire network.
As part of a repairing initiative, Ironwood has been tasked with answering ~Q~ queries of the form ~a~, ~b~ — whether beacon ~b~ will ever be lit when beacon ~a~ is lit.
Subtask 1 [80%]
- ~1 \le Q \le 100~
Subtask 2 [20%]
- ~1 \le Q \le 500~
For all cases, ~2 \le B \le 500~ and ~a \neq b~.
The first line of input will contain two space-separated integers ~B~ and ~Q~.
For the next ~B~ lines, line ~i~ will represent beacon ~i~, and will contain three space-separated positive integers: ~x_i~, ~y_i~, and ~r_i~. The value of these integers will not exceed ~10\,000~.
Finally, the next ~Q~ lines will each contain two space-separated integers representing a query: ~a~ and ~b~.
For each query, one line containing
YES if the two beacons are connected, or
2 2 1 1 5 4 1 1 1 2 2 1