#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;
}

