#include using namespace std; #define MOD 1000000007 #define PI 3.14159265 #define REP(i, a, b) \ for (int i = int(a); i < int(b); i++) #define TRvi(c, it) \ for (vi::iterator it = (c).begin(); it != (c).end(); it++) #define TRvii(c, it) \ for (vii::iterator it = (c).begin(); it != (c).end(); it++) #define TRmsi(c, it) \ for (msi::iterator it = (c).begin(); it != (c).end(); it++) typedef long long ll; typedef vector vi; typedef pair ii; typedef vector vii; typedef set si; typedef map msi; int main() { int q,n,x,y; cin>>q; while(q--){ bool x=true; cin>>n; ii a[n]; REP(i,0,n){ cin>>x>>y; a[i]=make_pair(x,y); } REP(i,1,n) if(a[i].first!=a[0].first && a[i].second!=a[0].second){ x=false;break; } if(x)cout<<"YES"; else cout<<"NO"; cout<