New Ground

Time Limit: 10000ms
Memory Limit: 65536KB
This problem will be judged on HDU. Original ID: 3365
64-bit integer IO format: %I64d      Java class name: Main

Description

Your school has a large ground. Recently the school wants a new ground similar to the former one.
The ground is a simple polygon. Suppose it has n edges and the old one is A0,A1,…,An-1, the new one is B0,B1,…,Bn-1.
They must be one-to-one mapping.
The new ground can be only worked out by rotating, expanding, contracting and shifting, but not flipping.
Now you know all the points of the old ground, B0, and B1. Can you calculate the other points of the new ground?

Input

The first line contains one integer T representing the number of test cases.
For each case, first line contains one integer n (3<=n<=10000).
Then n lines follow. The i-th line has two integers representing the coordinate of the point Ai. (For each 0<=i<j<n, Ai doesn't equals Aj)
Following one line contains four integers. The first two integers represent the coordinate of the point B0, and the second two integers represent the coordinate of the point B1. B0 never equals B1.
All coordinates are within [-10000, 10000].
The old ground always has a positive area.

Output

For each test case, in the first line print the case number.
Then print n lines followed. The i-th line contains two numbers separated by one space representing the coordinate of the point Bi, rounded to 2 digits after the decimal point.

Please follow the format of the sample output.

Sample Input

2
3
0 0
1 0
0 1
2 0 2 2
4
0 0
2 0
2 1
0 1
5 0 5 1

Sample Output

Case 1:
2.00 0.00
2.00 2.00
0.00 0.00
Case 2:
5.00 0.00
5.00 1.00
4.50 1.00
4.50 0.00

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .