6582: Map

内存限制:256 MB 时间限制:10.000 S
评测方式:特殊裁判 命题人:
提交:2 解决:0

题目描述

Sakuyalove has a large world map M and a small world map m. Both of the them are in the shape of rectangle. The small map m is compressed from the large map M. If the length of M is a and the width of M is b, then the length of m is ka and the width of m is kb, where 0<k<1. Now Sakuyalove puts the small map m on the large map M such that the small map is completely within the big map (including boundaries). She was surprised to find out that no matter how she places the small map, there always exists exactly one point P represents the same place in small map and large map (For example, in the following pictures, the location of the pin on both maps represents Tokyo, Japan). Sakuyalove wants to find out this point P. Please help her.

输入

The first line contains one integer T(1≤T≤10^5), described the number of test cases.

Each test case contains eight lines. Each line has two integers x,y(−10^3≤x,y≤10^3) separated by one space.

The first four lines are the coordinates of the upper left corner, the upper right corner, the lower right corner and the lower left corner of M.

The last four lines are the coordinates of the upper left corner, the upper right corner, the lower right corner and the lower left corner of m.

It is guaranteed that m is within M, both of the them are in the shape of rectangle, and m is compressed from M.

Please note that the upper left corner, the upper right corner, the lower right corner and the lower left corner of m and M are one-to-one corresponding. For example, in the picture of Hint below, the correspondence of points is A−aB−bC−cD−d. But A−cB−dC−aD−b is not allowed.

输出

Your output should contains T lines. Each line contains two real numbers x,y separated by one space, represents the coordinates of the point P. Your absolute error should not exceed 10^−6.

样例输入 复制

1
0 5
15 5
15 0
0 0
3 2
9 5
10 3
4 0

样例输出 复制

6.000000 2.000000

提示

In the first example, the picture is like this: