#include #include #include #include #include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ long int i,j,k,q,t,a[10][2],x1,y1,x2,y2; cin >> t; while(t--){ cin >> j; k = j; i = 0; x1 = 10001, x2 = -10001, y1 = 10001, y2 = -10001; while(k--){ cin >> a[i][0] >> a[i][1]; x1 = min(x1,a[i][0]); x2 = max(x2,a[i][0]); y1 = min(y1,a[i][1]); y2 = max(y2,a[i][1]); i++; } for(i = 0; i < j; i++){ q = 0; if(a[i][0] == x1 || a[i][0] == x2){ q = 1; } if(a[i][1] == y1 || a[i][1] == y2){ q = 1; } if(q == 0) break; } if(q == 1) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }