boolcheckRec(int** coord){ for (int i = 0; i < 4; i++) if (isPoint(coord[i])) returnfalse;
int count = 0; for (int i = 0; i < 4; i++) { for (int j = i + 1; j < 4; j++) { if (intersect(coord[i], coord[j])) { if (isVertical(coord[i], coord[j])) count++; else returnfalse; } } } if (count == 4) returntrue;
returnfalse; }
intmain(){ int T = 0; cin >> T; for (int i = 0; i < T; i++) { int** coord = newint*[4]; for (int i = 0; i < 4; i++) coord[i] = newint[4]; for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) cin >> coord[i][j];
cout << (checkRec(coord) ? "YES" : "NO") << endl;
for (int i = 0; i < 4; i++) delete[] coord[i]; delete[] coord; }