/*
Name:nyoj-1099-Lan Xiang's Square
Copyright:
Author:
Date: 2018/4/26 9:19:19
Description:
给4个点,判断是否形成正方形
double类型的值比较大小,直接判断==0竟然A了,然而小于1e-6竟然WA
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
struct node {
double x, y;
}nodes[];
double length_edge(node a, node b) {
return (b.x - a.x)*(b.x - a.x) + (b.y - a.y)*(b.y - a.y);
}
int main()
{
// freopen("in.txt", "r", stdin);
int t;
cin>>t;
while (t--) {
for (int i=; i<; i++)
cin>>nodes[i].x>>nodes[i].y;
double edge[];
edge[] = length_edge(nodes[], nodes[]);
edge[] = length_edge(nodes[], nodes[]);
edge[] = length_edge(nodes[], nodes[]);
if (count(edge, edge+, ) >) {
cout<<"No"<<endl;
continue;
}
sort(edge, edge+);
// if (edge[0] - edge[2] + edge[1] < 1e-6 && (edge[0] - edge[1]) < 1e-6) { //WA
if (edge[] - edge[] + edge[] == && (edge[] - edge[]) == ) {
cout<<"Yes"<<endl;
} else {
cout<<"No"<<endl;
}
}
return ;
}