#include #include #include #include #include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int i,q,n,x1,x2,y1,y2; const int inf = 1e8; cin >> q; while(q--) { cin >> n; x1 = y1 = inf; x2 = y2 = -inf; vector x(n),y(n); for(i = 0; i < x.size(); i++) { cin >> x[i] >> y[i]; x1 = min(x1,x[i]); y1 = min(y1,y[i]); x2 = max(x2,x[i]); y2 = max(y2,y[i]); } for(i = 0; i < x.size(); i++) { if(x[i] != x1 && x[i] != x2 && y[i] != y1 && y[i] != y2) { cout << "NO" << endl; break; } } if(i == x.size())cout << "YES" << endl; } return 0; }