#include #include #include #include #include using namespace std; int main() { int q; cin>>q; while(q--) { int n; cin>>n; int rect[n][2]; for(int i = 0;i>rect[i][0]>>rect[i][1]; if(n<4) { cout<<"YES\n"; continue; } int xi = rect[0][0], yi = rect[0][1], xj = rect[1][0], yj = rect[1][1],countx = 1, county = 1; for(int i = 1;i1&&tx!=xi&&tx!=xj) { countx++; } if(county>1&&ty!=yi&&ty!=yj) { county++; } } if(countx>2&&county>2) cout<<"NO\n"; else cout<<"YES\n"; } return 0; }