A point set S is symmetric about a line ℓ if and only if there exists s′∈S satisfying that s′ and s are symmetric about the line ℓ for all s∈S.
Let us denote the distance between two points a and b as d(a,b). The distance between two non-empty point sets A and B is \inf \left\\{d(a,b) : a \in A, \\, b \in B \right\\}. The infimum of a non-empty real number set S is the maximum value of x which satisfies x≤s for all s∈S.
Lines ℓ_1,ℓ_2,…,ℓ_n are given, where two or more lines may coincide. For a point s, define C(s) as the intersection of all sets S satisfying s∈S such that S is symmetric about ℓ_i for all i=1,2,…,n.
There are q queries. For each query, given two points A and B, find the distance between C(A) and C(B).
There are multiple test cases. The first line of input contains an integer T (1≤T≤105), the number of test cases. For each test case:
The first line contains an integer n and q (1≤n,q≤105): the number of lines and the number of points.
The i-th of the following n lines contains four integers x_P_i, y_P_i, x_Q_i, and y_Q_i: the coordinates of P_i and Q_i such that ℓ_i passes through P_i and Q_i. It is guaranteed that x_P_i=x_Q_i or y_P_i=y_Q_i. Any two lines may coincide.
The i-th of the following q lines contains four integers x_A_i, y_A_i, x_B_i, and y_B_i: the coordinates of A_i and B_i.
It is guaranteed that the absolute value of all coordinates in the input does not exceed 109.
It is guaranteed that both the sum of n and the sum of q over all test cases do not exceed 105.
For each test case:
For each query, output the distance between C(A) and C(B).
The distance you output will be considered correct if the relative error or absolute error to the jury does not exceed 10−9.