#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef double ld; typedef vector < long long > vll; typedef pair pll; typedef pair pii; typedef vector < int > vii; typedef complex < double > Point; #define csl ios_base::sync_with_stdio(false); cin.tie(NULL) #define mp make_pair #define fst first #define snd second ll t, n, m, u, v, q, r, ql, qr, k, l, s, w, z, x, y, d, p, c, L, b; const int N = 2e5 + 500; const int NN = 1e4 + 4; const long long mod = 1e9 + 7; const long long INF = 1LL << 52LL; int wx, wy, ex, ey, xx[N], yy[N]; bool in(int xa, int ya) { if (xa > ex || xa < wx) return false; if (ya > wy || ya < ey) return false; if (xa == wx || ya == wy || xa == ex || ya == ey) return true; return false; } int main() { csl; cin >> q; while (q--) { cin >> n; for (int i = 0; i < n; ++i) { cin >> xx[i] >> yy[i]; } bool valid = false; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { for (int k = 0; k < n; ++k) { for (int l = 0; l < n; ++l) { wx = xx[i]; wy = yy[j]; ex = xx[k]; ey = yy[l]; if (wx == ex) wx = ex - 1; if (wy == ey) wy = ey + 1; if (wx > ex) swap(wx, ex); if (ey > wy) swap(wy, ey); if (wx >= ex || wy <= ey) continue; bool Valid = true; for (int m = 0; m < n; ++m) { Valid &= in(xx[m], yy[m]); } valid |= Valid; } } } } if (valid) cout << "YES\n"; else cout << "NO\n"; } return 0; }