#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; cin >> T; for(int i = 0; i < T; i++) { int N; bool fail = false; cin >> N; vector< pair > a(N); int xMin = 1000000,yMin = 10000000, xMax = -1000000, yMax = -100000000; for(int j = 0; j < N; j++) { cin >> a[j].first >> a[j].second; xMin = min(xMin,a[j].first); yMin = min(yMin,a[j].second); xMax = max(xMax,a[j].first); yMax = max(yMax,a[j].second); } for(int j = 0; j < N; j++) { if(a[j].first != xMin && a[j].first != xMax && a[j].second != yMin && a[j].second != yMax) { fail = true; break; } } if(fail) { cout << "NO\n"; } else { cout << "YES\n"; } } return 0; }