Intersection of Rectangles
In the plane, there are n rectangles, each with vertices at integer coordinate points and sides parallel to the coordinate axes. Your task is to determine the rectangle that represents their intersection.
Demonstrate that this intersection forms a rectangle.
Input
The first line of the input specifies the number N (1 ≤ N ≤ 1500). Each of the following N lines contains 4 integers: x_1, y_1, x_2, y_2. These represent the coordinates of the bottom-left corner and the top-right corner of a rectangle, respectively (-10^9 ≤ x_1 ≤ x_2 ≤ 10^9, -10^9 ≤ y_1 ≤ y_2 ≤ 10^9). Note that rectangles can degenerate into line segments or even points.
Output
Output a single line describing the rectangle of intersection in the same format as the input. If the intersection of the rectangles is empty, output the single number -1.