Rectangles |
Input consists of several test cases. Each test case begins with an integer n ( 1n1000), representing the number of rectangles. This is followed by n lines each describing a rectangle using 8 integer numbers x1, y1, x2, y2, x3, y3, x4, y4, where each (xi, yi) is a vertex. All coordinate values are between -109 and 109. The input is terminated by a line containing `0' which should not be processed.
For each test case, output a line containing either `YES' if the selection is possible or `NO' if not.
4 0 1 1 1 1 0 0 0 1 1 2 1 2 0 1 0 2 3 5 3 5 0 2 0 2 3 3 3 3 2 2 2 7 0 10 10 10 10 0 0 0 10 10 20 10 20 0 10 0 20 30 50 30 50 0 20 0 20 30 30 30 30 20 20 20 30 10 40 10 40 0 30 0 5 0 30 0 30 -10 5 -10 0 0 5 0 5 -10 0 -10 0
YES NO