#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--){
ll n, i, j;
cin >> n;
vector<pair<ll,ll> > arr(n);
pair<ll,ll> first, last;
map<ll,map<ll,ll> > m1;
for(i = 0; i < n; i++){
cin >> arr[i].first >> arr[i].second;
m1[arr[i].first][arr[i].second] = 1;
if(arr[i].first == 1){
first = {arr[i].first, arr[i].second};
}
else if(arr[i].second == n){
last = {arr[i].first, arr[i].second};
}
}
ll x, y;
x = first.first; y = first.second;
bool ok = false;
while(y >= 1){
if(m1[x][y] == 0){
ok = true;
break;
}
x += 1;
y -= 1;
}
if(!ok){
cout << "NO" << endl;
continue;
}
x = last.first; y = last.second;
while(x <= n){
if(m1[x][y] == 0){
ok = true;
break;
}
x += 1;
y -= 1;
}
if(!ok)
cout << "NO" << endl;
else
cout << "YES" << endl;
}
return 0;
}
I3ByYWdtYSBHQ0Mgb3B0aW1pemUoIk9mYXN0IikKI3ByYWdtYSBHQ0MgdGFyZ2V0KCJhdngsYXZ4MixmbWEiKQojaW5jbHVkZTxiaXRzL3N0ZGMrKy5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwp0eXBlZGVmIGxvbmcgbG9uZyBpbnQgbGw7CmludCBtYWluKCl7CiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKGZhbHNlKTsKICAgIGNpbi50aWUoMCk7Y291dC50aWUoMCk7CiAgICBpbnQgdDsKICAgIGNpbj4+dDsKICAgIHdoaWxlKHQtLSl7CiAgICAgICAgbGwgbiwgaSwgajsKICAgICAgICBjaW4gPj4gbjsKICAgICAgICB2ZWN0b3I8cGFpcjxsbCxsbD4gPiBhcnIobik7CiAgICAgICAgcGFpcjxsbCxsbD4gZmlyc3QsIGxhc3Q7CiAgICAgICAgbWFwPGxsLG1hcDxsbCxsbD4gPiBtMTsKICAgICAgICBmb3IoaSA9IDA7IGkgPCBuOyBpKyspewogICAgICAgICAgICBjaW4gPj4gYXJyW2ldLmZpcnN0ID4+IGFycltpXS5zZWNvbmQ7CiAgICAgICAgICAgIG0xW2FycltpXS5maXJzdF1bYXJyW2ldLnNlY29uZF0gPSAxOwogICAgICAgICAgICBpZihhcnJbaV0uZmlyc3QgPT0gMSl7CiAgICAgICAgICAgICAgICBmaXJzdCA9IHthcnJbaV0uZmlyc3QsIGFycltpXS5zZWNvbmR9OwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgaWYoYXJyW2ldLnNlY29uZCA9PSBuKXsKICAgICAgICAgICAgICAgIGxhc3QgPSB7YXJyW2ldLmZpcnN0LCBhcnJbaV0uc2Vjb25kfTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBsbCB4LCB5OwogICAgICAgIHggPSBmaXJzdC5maXJzdDsgeSA9IGZpcnN0LnNlY29uZDsKICAgICAgICBib29sIG9rID0gZmFsc2U7CiAgICAgICAgd2hpbGUoeSA+PSAxKXsKICAgICAgICAgICAgaWYobTFbeF1beV0gPT0gMCl7CiAgICAgICAgICAgICAgICBvayA9IHRydWU7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgICB4ICs9IDE7CiAgICAgICAgICAgIHkgLT0gMTsKICAgICAgICB9CiAgICAgICAgaWYoIW9rKXsKICAgICAgICAgICAgY291dCA8PCAiTk8iIDw8IGVuZGw7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgIH0KICAgICAgICB4ID0gbGFzdC5maXJzdDsgeSA9IGxhc3Quc2Vjb25kOwogICAgICAgIHdoaWxlKHggPD0gbil7CiAgICAgICAgICAgIGlmKG0xW3hdW3ldID09IDApewogICAgICAgICAgICAgICAgb2sgPSB0cnVlOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgeCArPSAxOwogICAgICAgICAgICB5IC09IDE7CiAgICAgICAgfQogICAgICAgIGlmKCFvaykKICAgICAgICAgICAgY291dCA8PCAiTk8iIDw8IGVuZGw7CiAgICAgICAgZWxzZQogICAgICAgICAgICBjb3V0IDw8ICJZRVMiIDw8IGVuZGw7CiAgICB9CiAgICByZXR1cm4gMDsKfQoK