Time

13:10:39
23 May 2012
Version for print

Segments intersection

   Two segments are given in the plane with integer coordinates of its endpoints in Cartesian coordinate system. Determine whether they intersect (have a common point).


Specifications

   Input

   The first line contains the coordinates of the first endpoint of the first segment, the second line - the second endpoint of the first segment. The third and fourth lines - the corresponding coordinates of the second segment. The coordinates are integer, their absolute value do not exceed 10000.

   Output

   Print the word "Yes", if segments have common point, or "No" - otherwise.


Problem information

Time Limit: 1 seconds
Memory Limit: 64 MB
Balls for the passed test: 0.666667
Complexity: 37% 154/243
Classes: Geometry

Example

Example input

Sample 1
0 0
1 0
1 0
1 1

Sample 2
0 0
1 0
2 0
3 0

Example output

Sample 1
Yes

Sample 2
No


← Route Problems Long sum →