The demon Park Seung-won is looking for the most powerful laser in the world and has hired you for the task. You have a laser prototype, but before you can receive a budget to build it, you must show Park Seung-won a simulation.
The simulation begins by placing "mirrors", "beam splitters", and "beam detectors" on a 2D plane. Each object is modeled as a line segment.
Given a laser fired from a starting point in a given direction, determine which detectors absorb a beam. To simplify the problem, you may assume the following.
The first line contains the number of test cases $N$. Each test case is given as follows.
For each test case, first print "DATA SET #k", where $k$ is the test case number (starting from $1$).
If no detector absorbed a beam, print "NO BEAMS DETECTED".
Otherwise, print the numbers of the detectors that absorbed a beam (their object numbers from the input) in ascending order, one per line. Even if the same detector absorbs several beams, print its number only once.
Enigma - The Screen Behind The Mirror