#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll t,n,a[1010],b[1010],minmin,sum,cansx,cansy,cx,cy,xx[1010],yy[1010];
ll ssum(ll aaa,ll bbb)
{
    ll sssum=0;
    if(bbb)
    {
        for(ll i=0;i<n;i++)
        {
            sssum+=abs(b[i]-aaa);
        }
    }
    else
    {
        for(ll i=0;i<n;i++)
        {
            sssum+=abs(a[i]-aaa);
        }
    }
    return sssum;
}
int main()
{
    scanf("%lld",&t);
    while(t--)
    {
        scanf("%lld",&n);
        set<ll> x;
        set<ll> y;
        for(ll i=0;i<n;i++)
        {
            scanf("%lld%lld",&a[i],&b[i]);
            x.insert(a[i]);
            y.insert(b[i]);
        }
        //printf("ans=");
        /*if(n==2)
        {
            ll minx,maxx,miny,maxy;
            miny=minx=1010001000;
            maxy=maxx=-1;
            for(ll i=0;i<n;i++)
            {
                minx=min(minx,a[i]);
                maxx=max(maxx,a[i]);
                miny=min(miny,b[i]);
                maxy=max(maxy,b[i]);
                //printf("%lld %lld %lld %lld\n",minx,maxx,miny,maxy);
            }
            if(minx!=maxx&&miny!=maxy)printf("4\n");
            else if(minx==maxx)printf("%lld\n",maxy-miny+1);
            else if(miny==maxy)printf("%lld\n",maxx-minx+1);
        }
        else*/
        {
            minmin=10100010001000100;
            cansx=cansy=0;
            cx=cy=0;
            for(set<ll>::iterator it=x.begin();it!=x.end();++it)
            {
                xx[cx]=*it;
                cx++;
            }
            for(set<ll>::iterator it=y.begin();it!=y.end();++it)
            {
                yy[cy]=*it;
                cy++;
            }
            for(ll i=0;i<cx;i++)
            {
                if(ssum(xx[i],0)<minmin)
                {
                    minmin=ssum(xx[i],0);
                    if(ssum(xx[i]+1,0)==minmin&&i!=cx-1)
                    {
                        cansx=xx[i+1]-xx[i];
                    }
                    else cansx=1;
                }
                else if(ssum(xx[i],0)==minmin)
                {
                    if(ssum(xx[i]+1,0)==minmin&&i!=cx-1)
                    {
                        cansx+=xx[i+1]-xx[i];
                    }
                    else cansx+=1;
                }
            }
            minmin=10100010001000100;
            for(ll i=0;i<cy;i++)
            {
                if(ssum(yy[i],1)<minmin)
                {
                    minmin=ssum(yy[i],1);
                    if(ssum(yy[i]+1,1)==minmin&&i!=cy-1)
                    {
                        cansy=yy[i+1]-yy[i];
                    }
                    else cansy=1;
                }
                else if(ssum(yy[i],1)==minmin)
                {
                    if(ssum(yy[i]+1,1)==minmin&&i!=cy-1)
                    {
                        cansy+=yy[i+1]-yy[i];
                    }
                    else cansy+=1;
                }
            }
            printf("%lld\n",cansx*cansy);
        }
    }
    return 0;
}
