8556: Map

内存限制:128 MB 时间限制:10 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:3 通过:0

题目描述

Sakuyalove has a large world map M and a small world map mm. 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 aa and the width of M is b, then the length of mm is ka and the width of mm is kb, where 0<k<1. Now Sakuyalove puts the small map mm 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(1T105), described the number of test cases.

Each test case contains eight lines. Each line has two integers x,y(103x,y103) 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 mm is within MM, both of the them are in the shape of rectangle, and mm 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 mm and MM 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 PP. Your absolute error should not exceed 106.

输入样例 复制

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

输出样例 复制

6.000000 2.000000