#include #include #include #include #include #include #include #include #include #include #include #include #include #include #define all(x) x.begin() , x.end() #define fi first #define se second #define pb push_back #define umax( x , y ) x = max( x , (y) ) #define umin( x , y ) x = min( x , (y) ) #define For( i , a ) for(int i=1;i<=a;i++) #define ort (b+s)/2 #define y2 asrwjaelkf #define y1 asseopirwjaelkf #define set multiset using namespace std; inline int read() { int res = 0 ;int neg ; while(true){char ch = getchar();if(ch>='0' && ch<='9' || ch=='-'){if(ch=='-') neg = -1;else neg = 1 , res = ch-'0';break;} } while(true){char ch = getchar();if(ch>='0' && ch<='9') res*=10 , res+=ch-'0';else break;} return res*neg; } typedef long long Lint; typedef double db; typedef pair ii; typedef pair dd; typedef pair iii; typedef pair i4; const int maxn = 400320; const int maxm = 1000020; const int MOd = 1e9 + 7; int a; ii ar[maxn]; void solve() { scanf("%d",&a); for(int i=1;i<=a;i++) scanf("%d %d",&ar[i].fi,&ar[i].se); for(int i1=1;i1<=a;i1++) for(int i2=1;i2<=a;i2++) for(int i3=1;i3<=a;i3++) for(int i4=1;i4<=a;i4++) { int c = 0; for(int i=1;i<=a;i++) { if( ar[i].fi == ar[i1].fi && abs( ar[i].se - ar[i3].se ) + abs( ar[i].se - ar[i4].se ) == abs( ar[i3].se - ar[i4].se ) ) continue; if( ar[i].fi == ar[i2].fi && abs( ar[i].se - ar[i3].se ) + abs( ar[i].se - ar[i4].se ) == abs( ar[i3].se - ar[i4].se ) ) continue; if( ar[i].se == ar[i3].se && abs( ar[i].fi - ar[i1].fi ) + abs( ar[i].fi - ar[i2].fi ) == abs( ar[i1].fi - ar[i2].fi ) ) continue; if( ar[i].se == ar[i4].se && abs( ar[i].fi - ar[i1].fi ) + abs( ar[i].fi - ar[i2].fi ) == abs( ar[i1].fi - ar[i2].fi ) ) continue; c = 1; break; } if( !c ) { printf("YES\n"); return; } } printf("NO\n"); } int main() { //freopen("asd.in","r",stdin); //freopen("out.txt","w",stdout); int n; scanf("%d",&n); while( n-- ) solve(); return 0; }