Under construction

Still being built. Things may change

Equal Areas

Time limit1sMemory limit1024 MB

Summary
Given N segments, decide whether a point P exists whose triangle with each segment has the same area, and output one such rational point.
Level

Medium7 of 10

Topics
Geometry, Math
Solved
No attempts yet

Problem

There are NN line segments on a two-dimensional plane. Decide whether a point PP exists such that the triangle formed by PP 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 NN, the number of segments. (1≤N≤1000001 \le N \le 100000)

Each of the next NN lines contains the coordinates of the two endpoints of one segment, x1x_1, y1y_1, x2x_2, y2y_2, separated by spaces. (−106≤x1,y1,x2,y2≤106-10^6 \le x_1, y_1, x_2, y_2 \le 10^6)

Output

If no point PP satisfies the condition, print NO on the first line.

If a point PP satisfies the condition, print YES on the first line. On the second line, print the x-coordinate of PP, and on the third line, print the y-coordinate of PP, each in the form a/ba / b. Here aa and bb are integers with absolute value less than 104010^{40}, gcd⁡(a,b)=1\gcd(a, b) = 1, and b>0b > 0.

If the answer is YES, it can be proven that a rational point PP satisfying the output conditions exists.

Examples1

  1. Example 1

    Input
    3
    0 0 1 0
    2 0 2 1
    2 2 0 1
    
    Expected output
    YES
    4/1
    2/1