/*保证五角星的五条最长边相等*/
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<string.h>
using namespace std;
int main()
{
int T;
int i,j,k,t;
double node[5][2];
double mid[5][2],len[20],len1[5];
scanf ("%d",&T);
while (T--)
{
memset(len,0,sizeof (len));
for (i=0; i<5; i++)
{
scanf ("%lf%lf",&node[i][0],&node[i][1]);
}
k=0;
for (i=1; i<5; i++)
{
if (fabs(node[0][0]-node[i][0])<0.0001 && fabs(node[0][1]-node[i][1])<0.0001)
k++;
}
if (k==4)
{
printf("Yes\n"); continue;
}
t=0;
double MAX=0;
for (i=0; i<5; i++)
{
MAX=0;
len[t++]=sqrt((node[i][0]-node[(i+1)%5][0])*(node[i][0]-node[(i+1)%5][0])+(node[i][1]-node[(i+1)%5][1])*(node[i][1]-node[(i+1)%5][1]));
if (len[t-1]>MAX) MAX=len[t-1];
len[t++]=sqrt((node[i][0]-node[(i+2)%5][0])*(node[i][0]-node[(i+2)%5][0])+(node[i][1]-node[(i+2)%5][1])*(node[i][1]-node[(i+2)%5][1]));
if (len[t-1]>MAX) MAX=len[t-1];
len[t++]=sqrt((node[i][0]-node[(i+3)%5][0])*(node[i][0]-node[(i+3)%5][0])+(node[i][1]-node[(i+3)%5][1])*(node[i][1]-node[(i+3)%5][1]));
if (len[t-1]>MAX) MAX=len[t-1];
len[t++]=sqrt((node[i][0]-node[(i+4)%5][0])*(node[i][0]-node[(i+4)%5][0])+(node[i][1]-node[(i+4)%5][1])*(node[i][1]-node[(i+4)%5][1]));
if (len[t-1]>MAX) MAX=len[t-1];
len1[i]=MAX;
}
k=0;
for (i=1; i<5; i++)
{
if (fabs(len1[0]-len1[i])<0.0001 )
k++;
}
if (k==4)
{
printf("Yes\n");
continue;
}
else
printf("No\n");
}
return 0;
}