A point set

is symmetric about a line

if and only if there exists

satisfying that

and

are symmetric about the line

for all

.
Denoting the distance between two points

and

as
)
. The distance between two non-empty point sets

and

is
%3Aa%5Cin%20A%2Cb%5Cin%20B%5C%7D)
. The infimum of a non-empty real number set

is the maximum value of

which satisfies

for all

.

lines

,

,

,

are given, where two lines may coincide. For a point

, define
)
as the intersection of all sets

satisfying

and

is symmetric about

for all

,

,

,

. There are

queries. For each query, given two points

and

, find the distance between
)
and
)
.
输入描述:
There are multiple test cases. The first line of input contains an integer
(
), the number of test cases. For each test case:
The first line contains an integer
and
(
,
) -- the number of lines and the number of points.
The
-th of the following
lines contains four integers
,
,
and
-- the coordinates of
and
such that
passes through
and
. It is guaranteed that
or
. Two lines may coincide.
The
-th of the following
lines contains four integers
,
,
and
-- the coordinates of
and
.
It is guaranteed that the absolute value of all coordinates in the input does not exceed
.
It is guaranteed that the sum of
and the sum of
over all test cases does not exceed
.
输出描述:
For each test case:
For each query, output the distance between
and
.
The distance you output is correct if the relative error or absolute error to the jury does not exceed
.
示例1
输入
复制
4
1 1
0 0 1 0
-1 -2 2 1
2 1
0 0 1 0
0 0 0 1
-1 -2 2 1
3 1
0 0 1 0
0 0 0 1
0 0 1 1
-1 -2 2 1
3 1
0 0 1 0
0 0 0 1
0 0 1 2
-1 -2 2 1
输出
复制
3.162277660168
1.414213562373
0.000000000000
0.000000000000
示例2
输入
复制
5
1 1
-8 1 -8 10
-7 -5 -4 -6
2 2
-1 -10 -1 -8
10 9 9 10
2 10 -10 5
-4 4 -3 -3
3 1
-5 -10 -5 6
6 10 8 8
7 -2 4 -5
0 -9 -6 -3
3 3
9 8 10 7
1 5 -9 5
4 -2 -3 -9
6 6 -6 -8
2 -7 10 -3
3 -8 8 -9
1 3
10 -9 10 -7
-2 -7 -2 6
-2 9 -9 2
-6 -7 -7 -9
输出
复制
3.162277660168
7.810249675907
7.071067811865
7.211102550928
0.000000000000
0.000000000000
0.000000000000
13.000000000000
9.899494936612
2.236067977500