
ZOJ Problem Set  3976
Owen likes drawing. In drawing, perspective is a way of portraying three dimensional objects on a twodimensional flat surface by suggesting depth or distance. The two most common perspectives are onepoint perspective and twopoint perspective. In onepoint perspective, all the lines that are directly parallel with the viewer's line of sight converge at a unique vanishing point on the horizon line. In twopoint perspective, it contains two vanishing points on the horizon line, to which two sets of parallel lines converge. You task is to develop an intelligent program to help Owen judge whether a given drawing has onepoint perspective, twopoint perspective, or neither of them. To achieve this, the program needs to first extend all the segments in the drawing to lines. If all the lines (except horizontal or vertical lines) pass through the same point, the drawing must have onepoint perspective. If all the lines pass through two points, the drawing must have twopoint perspective. InputThe first line of the input contains the number of test cases T. For each test case, its first line contains an integer n with 1 ≤ n ≤ 1000, which is the number of segments in the given drawing. Each of the following n lines contains four integers x_{1}, y_{1}, x_{2}, y_{2} with representing the coordinates of the two end points of each segment. It is possible that some segments are colinear, i.e., they are lying on the same line. OutputFor each test case, output one line. If the drawing has onepoint perspective, print "Onepoint perspective". Otherwise, if the drawing has twopoint perspective, print "Twopoint perspective". Otherwise, print "Other". Notice that you should print "Other" for the following cases.
Sample Input3 7 8 8 2 8 8 8 8 6 2 8 2 6 8 6 2 6 2 8 1 4 2 6 1 3 8 6 4 4 4 3 3 2 2 3 3 5 7 4 2 1 1 4 2 1 6 3 0 0 1 1 2 3 3 4 1 9 2 10 Sample OutputOnepoint perspective Twopoint perspective Other Source: ACM Collegiate Programming Contest 2017 (Hong Kong) 