#P7691. [2019年杭电多校]Enveloping Convex

[2019年杭电多校]Enveloping Convex

Enveloping Convex

Problem Description

You are given a convex polygon P and m points q1, q2...qm. You need to find the minimum enveloping convex Q which is homologous with convex P and every opposite side of two polygons are parallel. Here, minimum enveloping convex Q means that it contains m points q1, q2, бн, qm (inside or on the border).

Input

The first line contains an integer T (<=30) denoting the number of test cases. The first line of each test case contains an integer n (3 <= n <= 50000, sum of n overall test cases <= 100000) denoting the number of vertices of convex P. Each of the next n lines contains two integers x and y denoting the coordinate of vertex Pi in clockwise or anticlockwise order. No 3 consecutive vertices lie in one line. The next line contains an integer m (1 <= m <= 100000, sum of m overall test cases <= 300000) denoting the number of given points. Each of the next m lines contains the coordinate of point qi. Two points qi and qj (i != j) may have the same coordinates. Absolute values of all coordinates are equal or less than 1000000.

Output

You must output minimum similitude ratio of convex Q to convex P. Your answer will be considered correct if the absolute or relative error is less than 10-5.

Sample Input

1

3

0 0

0 1

1 0

4

1 0

0 1

-1 0

0 -1

Sample Output

3.0000000000

Hint

Source

2019 Multi-University Training Contest 4