A fly just travelled between two points in the plane, stopping at several windows (segments) on its way. The fly does not have a very big brain, but it is powerful enough to fly in a straight line between stops. Now the fly wants to go back and visit the windows in reverse order, but it is still worried about efficiency. Is the reverse path optimal? Please help the fly with your bigger brain.
Input consists of several cases, which only have integer numbers. Every case begins with the number of segments . Follow the description of the … segments, in the order the fly visits them, each with two pairs with the coordinates of its two endpoints. Follow pairs with the coordinates of the points where the fly stopped at the segments, in order. The first pair is the initial position , and the last pair is the final position .
Assume . Segments are different, and do not intersect. The polygonal line does not cross any segment. For all , is strictly inside the segment . The length of each window and flight segment is strictly positive, and at most . No coordinate is larger than in absolute value.
Print “yes” if the polygonal line
is the shortest path between
and
that visits the segments
in this order. Print “no” otherwise.
All the required computations can be made with
long longs without overflows.
Input
1 500 0 500 100 0 0 500 50 0 100 1 500 0 500 100 0 0 500 50 0 50
Output
yes no