#include #include #include #include #include using namespace std; struct P { int x,y; }; int main() { int q; cin >> q; for (int i = 0; i < q; i++) { int n; cin >> n; vector

points(n); for (int j = 0; j < n; j++) { cin >> points[j].x >> points[j].y; } int left = 1000000, right = -1000000, top = -1000000, bottom = 1000000; for (int j = 0; j < n; j++) { left = min(left, points[j].x); right = max(right, points[j].x); bottom = min(bottom, points[j].y); top = max(top, points[j].y); } bool ok = true; for (int j = 0; j < n; j++) { if (points[j].x != left && points[j].x != right && points[j].y != bottom && points[j].y != top) { ok = false; break; } } cout << (ok ? "YES" : "NO") << endl; } }