#include #include #include #include #include using namespace std; int main() { int q; std::cin >> q; for (int i = 0; i < q; i++) { int n; int minx = 100000; int miny = 100000; int maxx = -100000; int maxy = -100000; std::cin >> n; std::vector > points(n); for (int j = 0; j < n; j++) { int x, y; std::cin >> x >> y; points[j].first = x; points[j].second = y; minx = std::min(minx, x); maxx = std::max(maxx, x); miny = std::min(miny, y); maxy = std::max(maxy, y); } //std::cout << minx << miny << maxx << maxy << std::endl; // verify bool fine = true; for (int j = 0; j < n; j++) { if (!((points[j].first == minx && points[j].second >= miny && points[j].second <= maxy) || (points[j].first == maxx && points[j].second >= miny && points[j].second <= maxy) || (points[j].second == miny && points[j].first >= minx && points[j].first <= maxx) || (points[j].second == maxy && points[j].first >= minx && points[j].first <= maxx))) { fine = false; break; } } std::cout << (fine? "YES" : "NO") << std::endl; } return 0; }