#include using namespace std; #define mp make_pair #define pii pair #define fi first #define se second const int nmax = 11; int q,n; pii a[nmax]; int main() { cin >> q; while(q--) { bool ok = 1; cin >> n; for(int i=1; i<=n; i++)cin >> a[i].fi >> a[i].se; sort(a+1,a+n+1); int d = 0; int d1 = -1e9,d2 = -1e9; for(int i=1; i 2) { cout << "NO" << endl; ok = 0; break; } if(a[i].se != d1) { if(d1 != -1e9) { if(a[i].se != d2) if(d2 == -1e9)d2 = a[i].se; else { cout << "NO" << endl; ok = 0; break; } } else d1 = a[i].se; } } if(ok)cout << "YES" << endl; } return 0; }