Delaunay
Time limit2sMemory limit1024 MB
For each given triangle of levers, check whether its circumscribed circle strictly contains any other lever point.
Statement
Where is the map, Billy? We need the map...
Black Dog
On this night, a gang of pirates plans to attack the Admiral Benbow and seize the treasure map. But young Jimmy Hawkins is already prepared. His pirate friend Delaunay built a clever mechanism of secret traps, and Jim waits on the second floor with nets.
The traps are a set of hidden levers on a plane. Some levers are grouped into traps. A trap is formed by any three levers, as long as its area is not zero. The areas shared by any two traps are zero. It is also guaranteed that the total area covered by the traps is maximal.
The system works as follows. As soon as a pirate steps into the area of one of the traps, Jim throws a round net from above, and the pirate is caught. The rim of the net is a circle that touches all three levers forming the trap the pirate stepped into.
The only weakness: if, at the moment the net is thrown, its inside covers a lever unrelated to the trap, the whole system fails. Jim wants to check whether the system is reliable. More precisely, he wants to know whether there is a trap such that the net for that trap (the circle circumscribed around the triangle formed by its levers) contains at least one more lever inside.
Input
The first line contains the number of tests (). Each test starts with a line containing the number of levers () and the number of traps . The next lines contain the integer coordinates () of the levers. The next lines each contain three integers (), the numbers of the levers forming the -th trap.
Output
For each test, print on a separate line YES if the system is reliable, that is, no lever lies inside the circle circumscribed around any trap. Otherwise, print NO.