eolymp
bolt
Try our new interface for solving problems
Problems

The segments

The segments

Two line segments are given on the plane. Each segment is parallel to either the X axis or the Y axis. Figure out how the segments intersect.

Input

Each of two lines contains four integers: x1, y1, x2, y2 (-1000x1, y1, x2, y21000) - the coordinates of segment endpoints.

Output

Print one of the next words:

  • "NO" - if the segments do not intersect;
  • "POINT" - if the segments' intersection forms a point;
  • "SEGMENT" - if the segments' intersection forms a line segment.
Time limit 1 second
Memory limit 128 MiB
Input example #1
0 0 0 1
1 0 1 1
Output example #1
NO