#include #include #include #include #include using namespace std; int x[1000]; int y[1000]; int q, n, i; bool t; struct p{ int x, y; p operator = (const p&a ){ x = a.x; y = a.y; return *this; } }a[10]; p v1, v2, v3, v4; int main() { cin>>q; while(q--){ cin>>n; t = true; for(i = 0; i < n; i++) cin>>a[i].x>>a[i].y; v1 = v2 = v3 = v4 = a[0]; for(i = 0; i < n; i++){ if (v1.x > a[i].x) v1 = a[i]; if (v1.x == a[i].x){ if(v1.y < a[i].y) v1 = a[i]; } if (v3.x < a[i].x) v3 = a[i]; if (v3.x == a[i].x){ if(v3.y > a[i].y) v3 = a[i]; } } for(i = 0; i < n; i++){ if( a[i].x == v1.x || a[i].y == v1.y || a[i].x == v3.x || a[i].y == v3.y ) t = true; else t = false; } cout<<(t ? "YES" : "NO")<< endl; } return 0; }