#include #include #include using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000001 const double eps = 1e-10; template struct point{ T x,y,rad,dir; point(T a=0.0,T b=0.0){ x = a; y = b; fix_rd(); } void update_x(T a,T b){ x = a*x + b; fix_rd(); } void update_x(T a){ update_x(0.0,a); } void update_y(T a,T b){ y = a*y + b; fix_rd(); } void update_y(T a){ update_y(0.0,a); } void update_rad(T a,T b){ rad = a*rad + b; fix_xy(); } void update_rad(T a){ update_rad(0.0,a); } void update_dir(T a,T b){ dir = a*dir + b; fix_xy(); } void update_dir(T a){ update_dir(0.0,a); } void fix_xy(){ x = rad * cos(dir); y = rad * sin(dir); fix_rd(); } void fix_rd(){ rad = hypot(x,y); if(rad==0.0)dir=0.0; else dir = atan2(y,x); fix_zero(); } void fix_zero(){ if(abs(x) V){ return hypot(x-V.x,y-V.y); } T size(){ return get_dis(point()); } T angle_difference(point V){ double ret = dir - V.dir; if(ret<-acos(-1.0))ret = acos(-1.0)*2.0+ret; if(ret>acos(-1.0))ret=-acos(-1.0)*2.0+ret; return ret; } //中点 point get_midpoint(point V){ V.update_x(0.5,x/2.0); V.update_y(0.5,y/2.0); return V; } T get_inner_product(point V){ return x*V.x+y*V.y; } T get_cross_product(point V){ return x*V.y-y*V.x; } point &operator+=(const point &another){ update_x(1,another.x); update_y(1,another.y); return (*this); } point &operator-=(const point &another){ update_x(1,-another.x); update_y(1,-another.y); return (*this); } point operator+(const point &another)const{ return (point(*this)+=another); } point operator-(const point &another)const{ return (point(*this)-=another); } void show(){ cout< struct line{ point a,t; line(){ } line(point V1,point V2){ a=V1; t=V2-V1; } T get_signed_dis(point V){ point PA = a-V; return PA.get_cross_product(t)/t.size(); } T get_dis(point V){ return abs(get_signed_dis(V)); } point get_projection(point P){ T r = t.get_inner_product(P-a)/t.size(); point temp = t; temp.update_rad(0.0,r); return a+temp; } point get_cross_point(line L){ point ret(1e20,1e20); if(abs(t.get_cross_product(L.t)) temp = t; temp.x *= d0/(d1-d0); temp.y *= d0/(d1-d0); ret = a - temp; return ret; } }; template struct segment{ point V1,V2; segment(point a=point(),point b=point()){ V1=a; V2=b; } T get_dis(point P){ T ret = 1e20; line L(V1,V2); point Q = L.get_projection(P); if(Q.x+eps>min(V1.x,V2.x)&&Q.y+eps>min(V1.y,V2.y) &&Q.x l){ if(get_cross_point(l).x<1e20)return 0.0; return min({get_dis(l.V1),get_dis(l.V2),l.get_dis(V1),l.get_dis(V2)}); } point get_cross_point(segment l){ line L1(V1,V2),L2(l.V1,l.V2); point P = L1.get_cross_point(L2); if(get_dis(P) (1e20,1e20); } }; template struct triangle{ point V[3]; triangle(point V1,point V2,point V3){ V[0] = V1; V[1] = V2; V[2] = V3; } point get_circumcenter(){ line L1(V[0],V[1]); point M1 = V[0].get_midpoint(V[1]); L1 = line(M1,L1.b,L1.a); line L2(V[1],V[2]); point M2 = V[1].get_midpoint(V[2]); L2 = line(M2,L2.b,L2.a); return L1.get_cross_point(L2); } T get_signed_area(){ return ((V[1].x-V[0].x)*(V[2].y-V[0].y) - (V[2].x-V[0].x)*(V[1].y-V[0].y))/2.0; } T get_area(){ return abs(get_signed_area()); } bool is_inside(point P){ T S = triangle(V[0],V[1],P).get_area() + triangle(V[1],V[2],P).get_area() + triangle(V[2],V[0],P).get_area(); return abs(S - get_area()) X = V[1]-V[0],Y = V[2]-V[1]; return X.x*Y.y-X.y*Y.x < 0.0; } }; template struct polygon{ vector> V; polygon(vector> v){ V = v; } bool is_convex(){ bool f = false; for(int i=0;i tri(V[i],V[(i+1)%V.size()],V[(i+2)%V.size()]); if(i==0)f = tri.is_clockwise(); else{ if(tri.is_clockwise()!=f)return false; } } return true; } T get_signed_area(){ T ret = 0.0; for(int i=1;i tri(V[0],V[i],V[i+1]); ret += tri.get_signed_area(); } return ret; } T get_area(){ return abs(get_signed_area()); } T get_diameter(){ vector dis(V.size()); int now = 0; for(int i=0;i P){ for(int i=0;i l(V[i],V[(i+1)%V.size()]); if(l.get_dis(P) P){ if(is_on_side(P))return true; double R = 0.0; for(int i=0;i p1(V[i]-P),p2(V[(i+1)%V.size()]-P); R += p1.angle_difference(p2); } return abs(R)>=eps; } }; template struct circle{ point C; T R; circle(point c=point(),T r=0.0){ C = c; R = r; } vector> get_cross_point(circle C2){ vector> ret; T d = C.get_dis(C2.C); if(d>R+C2.R+eps)return ret; if(d+eps e1 = (C2.C-C); e1.update_rad(1.0/d,0.0); point e2 = e1; e2.update_dir(1.0,acos(-1.0)/2.0); e1.update_rad(Rc,0.0); e2.update_rad(Rs,0.0); ret.push_back(C + e1+e2); e2.update_dir(1.0,-acos(-1.0)); ret.push_back(C+e1+e2); return ret; } vector> get_cross_point(line L){ vector> ret; auto p = L.get_projection(C); if(p.get_dis(C)>R+eps)return ret; double tr = pow(R,2.0) - pow(p.get_dis(C),2.0); tr = sqrt(tr); { auto pp = L.t; pp.update_rad(0.0,tr); ret.push_back(p + pp); } { auto pp = L.t; pp.update_rad(0.0,-tr); ret.push_back(p + pp); } return ret; } }; int main(){ int q; cin>>q; circle C; { vector> t(3); rep(i,3){ double x,y; cin>>x>>y; t[i]= point(x,y); } double ok = 1e4,ng = 0; rep(_,100){ double mid = (ok+ng)/2.0; vector> cs(3); rep(i,3){ cs[i] = circle(t[i],mid); } bool f = true; vector> ps; rep(i,3){ for(int j=i+1;j<3;j++){ auto ret = cs[i].get_cross_point(cs[j]); rep(k,ret.size()){ ps.push_back(ret[k]); } } } f = false; rep(i,ps.size()){ rep(j,3){ if(ps[i].get_dis(t[j])<=mid + eps)continue; goto L; } f = true; break; L:; } if(f)ok = mid; else ng = mid; } double mid = ok; vector> cs(3); rep(i,3){ cs[i] = circle(t[i],mid); } bool f = true; vector> ps; rep(i,3){ for(int j=i+1;j<3;j++){ auto ret = cs[i].get_cross_point(cs[j]); rep(k,ret.size()){ ps.push_back(ret[k]); } } } f = false; rep(i,ps.size()){ rep(j,3){ if(ps[i].get_dis(t[j])<=mid + eps)continue; goto LL; } C.C = ps[i]; C.R = mid; break; LL:; } } rep(_,q){ point t; double x,y; cin>>x>>y; t = point(x,y); //cout<