#include #include #include #include #include using namespace std; struct point { unsigned long int x; unsigned long int y; }; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int q; cin >> q; for (int i = 0; i < q; ++i) { struct point p[10]; int minX, maxX, minY, maxY, t; cin >> t; for (int j = 0; j < t; ++j) { cin >> p[j].x; cin >> p[j].y; } minX = p[0].x; maxX = p[0].x; for (int j = 1; j < t; ++j) { if (minX > p[j].x) minX = p[j].x; if (maxX < p[j].x) maxX = p[j].x; } minY = p[0].y; maxY = p[0].y; for (int j = 1; j < t; ++j) { if (minY > p[j].y) minY = p[j].y; if (maxY < p[j].y) maxY = p[j].y; } for (int j = 0; j < t; ++j) { bool a = (minX < p[j].x) && (p[j].x < maxX); bool b = (minY < p[j].y) && (p[j].y < maxY); if (a && b) { cout << "NO" << endl; exit(0); } } cout << "YES" << endl; } return 0; }