#include #include #include #include #include using namespace std; int q,n,x,y,k,i,OK; int xmin, xmax, ymin, ymax; int coord[100][3]; int main() { cin >> q; for (k = 1; k <= q; k++) { xmax = ymax = -1000000; xmin = ymin = 1000000; cin >> n; for (i = 1; i <= n; i++) { cin >> x >> y; coord[i][1] = x; coord[i][2] = y; if (coord[i][1] > xmax) xmax = coord[i][1]; if (coord[i][2] > ymax) ymax = coord[i][2]; if (coord[i][1] < xmin) xmin = coord[i][1]; if (coord[i][2] < ymin) ymin = coord[i][2]; } OK = 1; for (i = 1; i <= n; i++) { if (coord[i][1] <= xmax&&coord[i][1] >= xmin && (coord[i][2] == ymin || coord[i][2] == ymax)) continue; if (coord[i][2] <= ymax&&coord[i][2] >= ymin && (coord[i][1] == xmin || coord[i][1] == xmax)) continue; OK = 0; } if (OK) cout << "YES\n"; else cout << "NO\n"; } return 0; }