#include using namespace std; #define endl '\n' void io(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.precision(15); } vector> v ; int main(int argc,char* argv[]) { io() ; #ifndef ONLINE_JUDGE // freopen("inp.txt", "r", stdin) ; // freopen("out.txt", "w", stdout); #endif int n , q ; cin >> q ; int x,y ; while(q--){ cin >> n ; int x0 = 1e4 + 4 ; int x1 = -1e4 - 4 ; int y0 = 1e4 + 4 ; int y1 = -1e4 - 4 ; v.clear() ; for(int i = 0 ; i < n ; i++){ cin >> x >> y ; v.push_back({x,y}) ; x0 = min(x0 , x) ; y0 = min(y0 , y) ; x1 = max(x1 , x) ; y1 = max(y1 , y) ; } bool ok = 1; for(auto p:v){ if(p.first == x0 || p.first == x1 || p.second == y0 || p.second == y1){ } else{ ok = 0 ; } } if(ok) cout << "YES\n" ; else cout << "NO\n" ; } return 0 ; }