#include #include #include #include #include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int q; cin >> q; while(q--) { int n; cin >> n; int j = 0, flag, k=0; while(n--) { int x, y; cin >> x >> y; j = max(x,y); k = max(k,j); if(x == k) { if(y >=0 && y <= k) flag = 0; } else if (y ==k) { if(x >=0 && x >= k) flag = 0; } else if( (x > 0 && y!=k) || (x!=k && y > 0)) { flag = 1; break; } } if(flag == 1) { cout << "NO" << endl; } else { cout << "YES" << endl; } } return 0; }