#include #include #include #include #include #include #include #include #include #include #include #include #define LL long long #define INF 0x3f3f3f3f #define RR freopen("in.txt","r",stdin) #define WW freopen("out.txt","w",stdout) #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 using namespace std; struct di { double x,y; }a[10]; int judge(double x,double y) { if(fabs(x-y)<1e-4) return 1; else return 0; } double dis(di aa,di bb) { return (aa.x-bb.x)*(aa.x-bb.x)+(aa.y-bb.y)*(aa.y-bb.y); } double d[10][10]; int main() { int t; scanf("%d",&t); while(t--) { int f=0; for(int i=1;i<=5;i++) scanf("%lf%lf",&a[i].x,&a[i].y); for(int i=1;i<=5;i++) for(int j=1;j<=5;j++) d[i][j]=dis(a[i],a[j]); for(int i=1;i<=5;i++) sort(d[i]+1,d[i]+6); for(int i=1;i<=5;i++) if(!judge(d[i][2],d[i][3]) || !judge(d[i][4],d[i][5])) f=1; for(int i=1;i<5;i++) if(!judge(d[i][2],d[i+1][2]) || !judge(d[i][4],d[i+1][4])) f=1; if(f) printf("No\n"); else printf("Yes\n"); } return 0; }