407080: GYM102697 051 The Convergence of Two Tetra-sided Polygons, Known as Rectangles
Description
You will be given two opposite corners of two separate rectangles and you must determine whether they intersect or not.
InputThe first line will contain 4 integers separated by spaces, which respectively represent the x-coordinate and y-coordinate of a corner of the rectangle and the x-coordinate and y-coordinate of the opposite corner. The second line will contain another 4 integers that represent the same coordinates but for the second rectangle.
OutputPrint "YES" (without the quotes) if the rectangles intersect or "NO" (without the quotes) if the rectangles do not intersect.
ExampleInput-5 -5 5 5 4 4 8 8Output
YESNote
The first rectangle has one corner located at (-5,-5) and the opposite corner at (5,5). The second rectangle has one corner located at (4,4) and the opposite corner at (8,8). These rectangles intersect, thus "YES" is printed
Also, if the rectangles lie on top of one another, they are intersecting. If one is inside the other and their perimeters do not touch, then they are not intersecting.