{
Problem:
Arithmetic Analysis:
Writer:
Data:
Remark:
AC:
}
program faraway;
const
filename='faraway';
maxn=100000;
var
t,n,m:longint;
ans:double;
x0,y0:array[0..maxn] of longint;
procedure solve;
var
i,j,k:longint;
dis:double;
begin
readln(t);
for i:=1 to t do
begin
readln(n,m);
for j:=1 to n+m do
readln(x0[j],y0[j]);
ans:=0;
for j:=1 to n+m do
for k:=i+1 to n+m do
begin
dis:=sqrt(sqr(x0[j]-x0[k])+sqr(y0[j]-y0[k]));
if ans<dis then ans:=dis;
end;
end;
end;
begin
assign(input,filename+'.in'); reset(input);
assign(output,filename+'.out'); rewrite(output);
solve;
writeln(ans:0:3);
close(input); close(output);
end.