#include using namespace std; #define FOR(i, a, b) for (int i=(a); i < (b); i++) #define RFOR(i, b, a) for (int i = (b)-1; i >= (a); i--) #define ITER(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++) #define FILL(a, value) memset(a, value, sizeof(a)) #define SZ(a) (int)a.size() #define ALL(a) a.begin(), a.end() #define MP make_pair #define PB push_back typedef long long LL; typedef vector VI; typedef pair PII; const double PI = acos(-1.0); const int INF = 1000 * 1000 * 1000 + 7; const LL LINF = INF * (LL) INF; const int MAX = 200005; struct Point { int x,y; Point operator - (Point b) { Point res; res.x=x-b.x; res.y=y-b.y; return res; } LL vm(Point b) { return x*b.y-y*b.x; } bool cw(Point b) { return vm(b)>=0; } bool ccw(Point b) { return vm(b)<=0; } LL sc(Point b) { return x*b.x+y*b.y; } }; Point p[47]; int main() { //freopen("in.txt", "r", stdin); //ios::sync_with_stdio(false); cin.tie(0); int q; cin>>q; FOR(qq,0,q) { int n; cin>>n; FOR(i,0,n) { cin>>p[i].x>>p[i].y; } int lx =INF,rx=-INF,ly=INF,ry=-INF; FOR(i,0,n) { lx = min(lx,p[i].x); rx = max(rx,p[i].x); ly = min(ly,p[i].y); ry = max(ry,p[i].y); } bool ok = true; //if(lx==rx || ly==ry)ok=false; FOR(i,0,n) { if((lx == p[i].x || rx == p[i].x) &&(ly<=p[i].y && ry>=p[i].y) )continue; if((ly == p[i].y || ry == p[i].y) &&(lx<=p[i].x && rx>=p[i].x) )continue; ok=false; } if(ok) { cout<<"YES\n"; } else cout<<"NO\n"; } }