#include #include #include #include #include #include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int t, n, x, y; cin >> t; while(t--){ cin >> n; vector > vec; int x1 = INT_MAX, x2 = INT_MIN, y1 = INT_MAX, y2 = INT_MIN; bool possible = true; for(int i = 0; i < n; i++){ cin >> x >> y; vec.push_back({x, y}); x1 = min(x1, x); x2 = max(x2, x); y1 = min(y1, y); y2 = max(y2, y); } for(int i = 0; i < n; i++){ if(vec[i].first != x1 && vec[i].first != x2 && vec[i].second != y1 && vec[i].second != y2){ possible = false; break; } } if(possible){ cout << "YES" << endl; } else{ cout << "NO" << endl; } } return 0; }