#include using namespace std; typedef long long int lli; int main() { int t; cin>>t; while(t--) { set x; set y; int n; cin>>n; int f=0; for(int i=0;i>a>>b; x.insert(a); y.insert(b); if(x.size()>2 && y.size()>2) { f=1; } } if(f==1) cout<<"NO"<