#include #include #include #include #include using namespace std; typedef unsigned int uint; typedef unsigned long long uint64; typedef long long sint64; int x[10], y[10]; int main(int argc, char* argv[]) { uint q; cin >> q; for (; q; --q) { uint n; cin >> n; int xm = 10000, xx = -10000, ym = 10000, yx = -10000; for (uint i = 0; i < n; ++i) { cin >> x[i] >> y[i]; if (x[i] < xm) xm = x[i]; if (x[i] > xx) xx = x[i]; if (y[i] < ym) ym = y[i]; if (y[i] > yx) yx = y[i]; } bool f = true; for (uint i = 0; i < n; ++i) { if (x[i] != xm && x[i] != xx && y[i] != ym && y[i] != yx) { f = false; break; } } cout << (f ? "YES\n" : "NO\n"); } return 0; }