#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; for (int g = 0; g < q; g++) { int n; cin >> n; vector x(n), y(n); for (int i = 0; i < n; i++) cin >> x[i] >> y[i]; int minx = x[0], maxx = x[0], miny = y[0], maxy = y[0]; for (int i = 1; i < n; i++) { if (x[i] > maxx) maxx = x[i]; if (x[i] < minx) minx = x[i]; if (y[i] > maxy) maxy = y[i]; if (y[i] < miny) miny = y[i]; } bool B = true; for (int i = 0; i < n; i++) if (x[i] < maxx && x[i] > minx && y[i] < maxy && y[i] > miny) B = false; if (B) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }