#include using namespace std; #define sz(x) ((int) (x).size()) #define forn(i,n) for (int i = 0; i < int(n); ++i) typedef long long ll; typedef long long i64; typedef long double ld; const int inf = int(1e9) + int(1e5); const ll infl = ll(2e18) + ll(1e10); void solve() { int n; cin >> n; int xl = inf, xr = -inf, yl = inf, yr = -inf; vector> p; forn (i, n) { int x, y; cin >> x >> y; xl = min(xl, x); xr = max(xr, x); yl = min(yl, y); yr = max(yr, y); p.emplace_back(x, y); } for (auto v: p) { if (v.first == xl || v.first == xr) continue; if (v.second == yl || v.second == yr) continue; cout << "NO\n"; return; } cout << "YES\n"; } int main() { #ifdef LOCAL assert(freopen("b.in", "r", stdin)); #else #endif int q; cin >> q; forn (i, q) solve(); }