A rectangular area specified in world coordinates is called a window. The rectangular area on the display device to which a window is mapped is called a viewport. The picture elements that fall within this window area is visible. In the viewport there is a block which is given higher priority for displaying. That is, those line segments that falls behind the block will not be visible. Assume the boundaries of a viewport: x=xmin, x=xmax, y=ymin, y=ymax, the boundaries of block: x′=xmin′, x′=xmax′, y′=ymin′, y′=ymax′, and (xi1 ,yi1) (xi2 ,yi2) : he endpoints of the lines in device coordinates.
Please calculate the coordinate value of the endpoints of all the visible line.
Input Format:
The boundaries of a viewport and block, endpoints of the lines in device coordinates.
xmin ymin xmax ymax
xmin′ ymin′ xmax′ ymax′
x11 y11 x12 y12
x21 y21 x22 y22
...
xn1 yn1 xn2 yn2
Output Format:
Endpoints of all the visible lines. Please sort the coordinate values of xi1′ ’s in descending order.
x11′ y11′ x12′ y12′
x21′ y21′ x22′ y22′
...
xk1′ yk1′ xk2′ yk2′
Note:
1. xi1′ < xi2′
2. In the condition of only the endpoints of the segments are falling on the boundaries of the viewport or block and the other part is invisible, please neglect it.
3. Integers: xmin, ymin , xmax , ymax, xmin′ , ymin′ , xmax′ , ymax′ ; float: xij, yij.
4. All float number should be accurate to 10−4
样例输入
0 0 5 5
1 2 2 3
3.0 3.0 7.0 7.0
9.0 7.0 2.0 6.0
4.0 2.0 1.1 4.0
9.0 -1.0 5.1 7.0
2.0 2.0 1.0 3.0
-2.5 3.1 5.2 -3.0
-1.0 7.3 -2.1 0.6
-2.1 5.6 6.0 7.0
-0.7 2.1 -5.2 12.6
样例输出
3.0000 3.0000 5.0000 5.0000
1.1000 4.0000 4.0000 2.0000
0.0000 1.1195 1.4131 0.0000