#define _CRT_SECURE_NO_WARNINGS #pragma comment(linker, "/stack:16777216") #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; #define FOR(i, a, b) for(int i=(a);i<(b);i++) #define RFOR(i, b, a) for(int i=(b)-1;i>=(a);--i) #define FILL(A,value) memset(A,value,sizeof(A)) #define ALL(V) V.begin(), V.end() #define SZ(V) (int)V.size() #define PB push_back #define MP make_pair #define Pi 3.14159265358979 typedef long long Int; typedef unsigned long long UInt; typedef vector VI; typedef pair PII; const int INF = 1000000000; const int MAX = 500007; const int MAX2 = 1000000; const int MAXD = 20; const int BASE = 1000000007; const int MOD = 1000000007; int main() { //freopen("in.txt" , "r" , stdin); int q; cin >> q; FOR(qq,0,q) { int n; cin >> n; vector A; int minY = INF; int maxY = -INF; int minX = INF; int maxX = -INF; FOR(i,0,n) { int x , y; cin >> x >> y; minY = min(minY , y); maxY = max(maxY , y); minX = min(minX , x); maxX = max(maxX , x); A.push_back(MP(x , y)); } bool ok = 1; FOR(i,0,n) { if (A[i].first == minX || A[i].first == maxX || A[i].second == minY || A[i].second == maxY) { } else { ok = 0; } } cout << (ok ? "YES" : "NO") << endl; } return 0; }