#include #include #include #include #include #define INF 10000000 using namespace std; int main() { int q,n; cin >> q; while(q--) { cin >> n; int x[n], y[n], x1 = INF, x2 = INF, y1 = INF, y2 = INF, flag = 1; for(int i=0;i> x[i] >> y[i]; int top = -INF, bottom = INF, left = INF, right = -INF; for(int i=0;i right) right = x[i]; if(x[i] < left) left = x[i]; if(y[i] > top) top = y[i]; if(x[i] < bottom) bottom = y[i]; } if(left == INF) left *= -1; if(right == -INF) right *= -1; if(top == -INF) top *= -1; if(bottom == INF) bottom *= -1; // cout << top << " " << bottom << " " << left << " " << right << "\n"; for(int i=0;i= bottom)) continue; else if ((y[i] == top || y[i] == bottom) && (x[i] <= right && x[i] >= left)) continue; else { flag = 0; break; } } if(flag) cout << "YES\n"; else cout << "NO\n"; } return 0; }