#include <cmath>#include <cstdio>#include <iomanip>#include <cstdlib>#include <cstring>#include <iostream>#include <algorithm>#define N 1010#define eps 1e-13#define pro 0.995751usingnamespacestd;
int t,n;
//This struct presents a point.struct Point
{
double x,y;
friend istream& operator >> (istream &_,Point &a)
{
scanf("%lf%lf",&a.x,&a.y);
return _;
}
friend ostream& operator << (ostream &_,Point a)
{
printf("The safest point is (%.1lf, %.1lf).\n",a.x,a.y);
return _;
}
Point(){}
Point(double _x,double _y):x(_x),y(_y){}
Point operator + (const Point &a)
{return Point(x+a.x,y+a.y);}
Point operator - (const Point &a)
{return Point(x-a.x,y-a.y);}
Point operator * (double rate)
{return Point(x*rate,y*rate);}
doubleoperator * (const Point &a)
{return x*a.x+y*a.y;}
doubleoperator ^ (const Point &a)
{return x*a.y-y*a.x;}
}pt[N],border;
//This function is going to get the distance of two points.double Get_Dis(Point a,Point b)
{
returnsqrt((a-b)*(a-b));
}
//The use of this function is to get the sum of the distance between the base point and the given point.double Get_Sum(Point now)
{
double ret=0x7f7f7f7f;
for(int i=1;i<=n;i++)ret=min(ret,Get_Dis(now,pt[i]));
return ret;
}
//This function is goint to simulate the process of tuihuo(chinese2333);
Point Tui_Huo(Point now,double basement)
{
if(basement<eps)return now;
double basex=rand()%1000/1000.0;
double basey=rand()%1000/1000.0;
int jd=rand()%2;
if(jd)basex=-basex;
jd=rand()%2;
if(jd)basey=-basey;
Point tmp(basex,basey);
Point to=now+tmp*basement;
to.x=min(border.x,max(0.0,to.x));
to.y=min(border.y,max(0.0,to.y));
double sumnow=Get_Sum(now),sumto=Get_Sum(to);
if(sumto>sumnow||fabs(sumto-sumnow)<eps)return Tui_Huo(to,basement*pro);
else
{
double delta=sumnow-sumto;
double rp=rand()%1000/1000.0;
if(exp(-delta/basement)<rp)
{
return Tui_Huo(to,basement*pro);
}elsereturn Tui_Huo(now,basement*pro);
}
}
int main()
{
srand(999329);
scanf("%d",&t);
while(t--)
{
cin>>border;
scanf("%d",&n);
for(int i=1;i<=n;i++)cin>>pt[i];
Point tmp(border.x/2.0,border.y/2.0);
Point ans=Tui_Huo(tmp,(border.x+border.y)/10.0);
cout<<ans;
}
}