Bright lights

The famous contempory art designer Momo is preparing its new open-air exhibit. It will consist of randomly placed poles emitting lasers in horizontal direction. All the lasers shall reach the so-called laser totem T. However, as the poles are placed randomly at different heights, a laser light L might be hidden behind a taller pole P, if P, T and L are aligned and if the height of P is larger or equal to the pole where L is attached. Your job is, given a configuration of poles, determine which are the visible poles. Input The input is a file containing several data sets. Each data set composed as follows. The first line contains an integer 0 < N ≤ 100000, giving the number of poles. The following N lines contain three integers−100000≤X≤100000,0≤Y ≤10000,and0≤Z≤10000suchthatXandY arethe coordinates of the pole and Z is the height of the pole in the position (X, Y ). You can assume that in a given data set, no two poles have the same X and Y coordinates and the position of the totem is (0, 0) and its height is infinite. The input ends with a line containing the number ‘0’. Output The output of the program shall indicate if all lights are visible or not. If some lights are invisible from the laser totem, the program shall output their X and Y coordinates, in increasing order of X-coordinate and Y -coordinate. Put a semicolon between the coordinates of two points that are not visible and put a dot after the coordinates of the last point that is not visible. See the sample output for an example of the expected formatting of the output. Sample Input 3 -1 0 1 011 101 5 -1 0 1 -1 1 2 -2 2 2 -3 3 3 -4 4 2 0 Sample Output Data set 1: All the lights are visible. Data set 2: Some lights are not visible: x = -4, y = 4; x = -2, y = 2.