import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.awt.Point;
import java.awt.Rectangle;

public class maks
{
    static int N;
    static int[] X, Y;
    static long inc, cnt;
    static HashSet<Point> taken, visited;

    static long inconvenience(long x, long y)
    {
        long res = 0;
        for (int n = 0; n < N; ++n)
        {
            res += Math.abs(x - X[n]);
            res += Math.abs(y - Y[n]);
        }
        return res;
    }

    static void search(int x, int y)
    {
        Point p = new Point(x, y);
        if (visited.contains(p))
            return;
        visited.add(p);

        if (taken.contains(p))
        {
            search(x + 1, y    );
            search(x    , y + 1);
            search(x - 1, y    );
            search(x    , y - 1);
        }
        else
        {
            long i = inconvenience(x, y);
            if (i < inc)
            {
                inc = i;
                cnt = 1;
            }
            else
            if (i == inc)
                ++cnt;
        }
    }


    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int cases = sc.nextInt();
        while (cases-- > 0)
        {
            N = sc.nextInt();
            X = new int[N];
            Y = new int[N];
            taken = new HashSet<Point>();
            for (int n = 0; n < N; ++n)
            {
                X[n] = sc.nextInt();
                Y[n] = sc.nextInt();
                taken.add(new Point(X[n], Y[n]));
            }

            Arrays.sort(X);
            Arrays.sort(Y);

            int x = X[(N - 1)/2], width  = X[N/2] - x + 1;
            int y = Y[(N - 1)/2], height = Y[N/2] - y + 1;
            cnt = (long)width*height;
            Rectangle rect = new Rectangle(x, y, width, height);
            for (Point p: taken)
                if (rect.contains(p))
                    --cnt;

            if (cnt > 0)
                inc = inconvenience(x, y);
            else
            {
                inc = (long)1e18;
                visited = new HashSet<Point>();
                search(x, y);
            }

            System.out.println(inc + " " + cnt);
        }
    }
}
