Rectangle Partitioning#5253

Rectangle Partitioning

1 second
64 megabytes
Hard

There is a rectangle with its sides parallel to the coordinate axes. One vertex of this rectangle is at , and the diagonally opposite vertex is at (M, N). This rectangle is divided into smaller rectangles of nonzero area, each with sides parallel to the coordinate axes (none of the rectangles overlap internally, and together they cover the original rectangle without gaps).

The positions of K - 1 of these rectangles are known. Find the coordinates of the two diagonally opposite vertices of the remaining rectangle.

Input

The first line contains three integers: the first two integers specify the coordinates and of the diagonally opposite vertex of the original rectangle; the third integer is the number of rectangles (1 \leq K \leq 10^5). The following K - 1 lines each contain four integers x_1, y_1, x_2, y_2, where (x_1, y_1) and (x_2, y_2) are the coordinates of two diagonally opposite vertices of one of the rectangles. All coordinates are integers and do not exceed 10^9 in absolute value. Integers in each line are separated by spaces.

Output

Print the coordinates of the two diagonally opposite vertices of the missing rectangle in the same format.

Examples

Example 1

Loading
Loading