F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Map

Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 524288/262144 K (Java/Others)
Total Submission(s): 1074    Accepted Submission(s): 419
Special Judge


Problem Description
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.

 

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

Each test case contains eight lines. Each line has two integers $x, y (-10^{3}\leq x, y\leq 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-a$, $B-b$, $C-c$, $D-d$. But $A-c$, $B-d$, $C-a$, $D-b$ is not allowed.
 

Output
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} $.
 

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

Sample Output
6.000000 2.000000
 

Hint
In the first example, the picture is like this:

 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 06:40:26, Gzip enabled