/*
  [BAPC'07] BARN
  by: Jan Kuipers
*/

using namespace std;

#include <iostream>
#include <queue>
#include <algorithm>
#include <set>

int main () {

  int runs;
  cin>>runs;
  while (runs--) {

    set<pair<int,int> > cow;
    
    int N;
    cin>>N;
    vector<int> x(N),y(N);
    for (int i=0; i<N; i++) {
      cin>>x[i]>>y[i];
      cow.insert(make_pair(x[i],y[i]));
    }

    vector<int> sx=x,sy=y;
    sort(sx.begin(),sx.end());
    sort(sy.begin(),sy.end());

    int x1,x2,y1,y2;
    if (N%2==1) {
      x1=x2=sx[N/2];
      y1=y2=sy[N/2];
    }
    else {
      x1=sx[N/2-1];
      x2=sx[N/2];
      y1=sy[N/2-1];
      y2=sy[N/2];
    }

    long long dist=0;
    for (int i=0; i<N; i++) 
      dist += (long long)abs(x[i]-x1) + abs(y[i]-y1);
	
    long long cnt = (long long)(x2-x1+1)*(y2-y1+1);
    for (int i=0; i<N; i++)
      if (x1<=x[i] && x[i]<=x2 && y1<=y[i] && y[i]<=y2) cnt--;

    if (cnt>0) {
      cout<<dist<<" "<<cnt<<endl;
      continue;
    }

    set<pair<int,int> > used;
    priority_queue<pair<long long,pair<int,int> > > q;
    
    for (int x=x1; x<=x2; x++) {
      q.push(make_pair(0,make_pair(x,y1)));
      q.push(make_pair(0,make_pair(x,y2)));
    }
    for (int y=y1; y<=y2; y++) {
      q.push(make_pair(0,make_pair(x1,y)));
      q.push(make_pair(0,make_pair(x2,y)));
    }

    cnt=0;
    int resd=-INT_MAX;
    
    while (!q.empty()) {
      int d = q.top().first;
      int x = q.top().second.first;
      int y = q.top().second.second;
      q.pop();

      if (used.count(make_pair(x,y))) continue;
      used.insert(make_pair(x,y));

      if (d < resd) break;
      if (!cow.count(make_pair(x,y))) resd=d, cnt++;
      
      int smallerx = (int)(lower_bound(sx.begin(),sx.end(),x)-sx.begin());
      int smallery = (int)(lower_bound(sy.begin(),sy.end(),y)-sy.begin());
      int biggerx  = N - (int)(upper_bound(sx.begin(),sx.end(),x)-sx.begin());
      int biggery  = N - (int)(upper_bound(sy.begin(),sy.end(),y)-sy.begin());

      if (2*smallerx < N) q.push(make_pair(d + 2*smallerx-N, make_pair(x-1,y)));
      if (2*smallery < N) q.push(make_pair(d + 2*smallery-N, make_pair(x,y-1)));
      if (2*biggerx  < N) q.push(make_pair(d + 2*biggerx -N, make_pair(x+1,y)));
      if (2*biggery  < N) q.push(make_pair(d + 2*biggery -N, make_pair(x,y+1)));
    }

    cout<<dist-resd<<" "<<cnt<<endl;
  }
    
  return 0;
}
