Digging a Well

No attempts yetTime limit1sMemory limit128 MB

Problem

Mr. Michal wants to dig a new well. He has a cross-section plan of his plot that shows two outlines: the ground surface and the top of the water-bearing layer (the aquifer). Both outlines are polylines, that is, chains of straight segments. Mr. Michal has already rented a special drill that can bore only vertically. Because drilling is quite expensive, he wants to know the minimum depth he has to bore in order to reach the aquifer from the surface.

In other words, find the vertical line (a single xx coordinate) at which the vertical distance between the surface and the aquifer is smallest, and report that minimum distance.

Input

The first line contains one natural number ZZ (1Z51 \le Z \le 5), the number of test sets. The test sets follow, one after another.

The first line of a test set contains one natural number nn (2n1000002 \le n \le 100000), the number of vertices of the polyline describing the ground surface. The second line contains nn pairs of natural numbers xi yix_i\ y_i (1xi,yi1091 \le x_i, y_i \le 10^9), separated by single spaces; for every 1i<n1 \le i < n we have xi<xi+1x_i < x_{i+1}.

The next two lines describe the polyline of the top of the aquifer in the same way. The third line contains the number of vertices mm (2m2 \le m, n+m100000n + m \le 100000), and the fourth line contains mm pairs of natural numbers ui viu_i\ v_i (1ui,vi1091 \le u_i, v_i \le 10^9), separated by single spaces; for every 1i<m1 \le i < m we have ui<ui+1u_i < u_{i+1}.

The aquifer lies entirely below the ground surface (the two polylines share no point). Moreover, x1=u1x_1 = u_1 and xn=umx_n = u_m.

Output

For each test set, print on its own line a single positive real number: the minimum depth separating the surface from the aquifer. Round the value to exactly two decimal places.

Hint

In the first example the required depth difference equals 11 along the whole plot. In the second example the difference is smallest at x=5x = 5, where it equals exactly 22. In the third example the difference is smallest at x=10x = 10.