Equal Areas
Time limit1sMemory limit1024 MB
Given N segments, decide whether a point P exists whose triangle with each segment has the same area, and output one such rational point.
Problem
There are line segments on a two-dimensional plane. Decide whether a point exists such that the triangle formed by and each segment has the same area. If such a point exists, find one of them. If three points lie on one line, the area of the triangle formed by them is 0.
Input
The first line contains , the number of segments. ()
Each of the next lines contains the coordinates of the two endpoints of one segment, , , , , separated by spaces. ()
Output
If no point satisfies the condition, print NO on the first line.
If a point satisfies the condition, print YES on the first line. On the second line, print the x-coordinate of , and on the third line, print the y-coordinate of , each in the form . Here and are integers with absolute value less than , , and .
If the answer is YES, it can be proven that a rational point satisfying the output conditions exists.