#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
using namespace std;

int x[11000], y[11000];
int sx[11000], sy[11000];

unsigned int n;
unsigned long dist, nSpots, bestDist;

int cmp(const void *x, const void *y)
{
	return (*(int*)x)-(*(int*)y);
}

void trySpot(int _x, int _y)
{
	int ndist = 0;
	for(int j=0; j<n; j++)
		ndist += abs(x[j]-_x) + abs(y[j]-_y);
	
	if(ndist<bestDist)
		bestDist = ndist;

	for(int j=0; j<n; j++)
		if(x[j] == _x && y[j] == _y)
			return;	// Occupied spot
		
	// found a free spot, check inconvenience
	if(ndist<dist)
		dist = ndist, nSpots = 1;
	else if(ndist == dist)
		nSpots++;
}

long expand(int x1, int x2, int y1, int y2)
{
	int itt = 0;
	int w = x2-x1;
	int h = y2-y1;
	
	nSpots = 0;
	dist = 1<<30;
	
	while(1)
	{
		bestDist = 1<<30;
		
		// No free spots found, try less-optimal spots by expanding a bit
		itt++; // next itteration
			
		// Expand rectangle (x1,y1)-(x2,y) in 8 directions
		for(int i=0; i<w; i++)
		{
			trySpot(x1+i, y1-itt);
			trySpot(x2-i, y2+itt);
		}
		
		for(int i=0; i<h; i++)
		{
			trySpot(x1-itt, y2-i);
			trySpot(x2+itt, y1+i);
		}
		
		for(int i=0; i<itt; i++)
		{
			trySpot(x1-itt+i, y1-i);
			trySpot(x2+i, y1-itt+i);
			trySpot(x1-i, y2+itt-i);
			trySpot(x2+itt-i, y2+i);
		}

		if(nSpots>0 && dist < bestDist)
			return nSpots;
	}
}

void run()
{
	scanf("%d", &n);
	
	for(int i=0; i<n; i++)
		scanf("%d %d", &x[i], &y[i]);
	
	memcpy(sx, x, n*sizeof(int));
	memcpy(sy, y, n*sizeof(int));
	
	qsort(sx, n, sizeof(int), cmp);
	qsort(sy, n, sizeof(int), cmp);

	int x1 = sx[(n-1)/2], x2 = sx[n/2];
	int y1 = sy[(n-1)/2], y2 = sy[n/2];

	dist = 0;
	
	long long nSpots = 
		((long long)(x2-x1+1))*((long long)(y2-y1+1));	// width * height of 
														// optimal rectangle
	
	for(int i=0; i<n; i++)
	{
		if(x[i]>=x1 && x[i]<=x2 &&
		   y[i]>=y1 && y[i]<=y2)
		   nSpots--;
		   
		dist += abs(sx[i]-x1) + abs(sy[i]-y1);
	}
	
	if(nSpots==0) // Complex case where there is no optimal spot free	
		nSpots = expand(x1, x2, y1, y2);
	
	// Use iostream, since printf() doesn't have a portable 
	// way to print long long's...
	cout << dist << " " << nSpots << endl;
}

int main()
{
	int runs;
	scanf("%d", &runs);
	
	while(runs--)
		run();
}
