Module: Nested conditional statement. Difficult conditions


Problem

5 /14


Rectangles

Problem

Given two rectangles whose sides are parallel or perpendicular to the coordinate axes. The coordinates of the lower left and upper right corners of each of them are known. Find the coordinates of the lower-left and upper-right corners of the minimum rectangle containing the specified rectangles (the rectangle's border can touch its nested rectangles).

Input
The first line is the coordinates of the corners of the first rectangle  (4 numbers separated by spaces: x1, y1, x2, y2).
The second line is the coordinates of the corners of the second rectangle (4 numbers separated by a space: x3, y3, x4, y4).

Imprint
4 numbers separated by a space - the coordinates of the lower left and upper right corners of the minimum rectangle.

 
Examples
# Input Output
1 0 0 7 4
3 1 9 5
0 0 9 5