// Arup Guha
// 4/29/2020
// Alternate Solution to 2020 FHSPS Problem: Alternate X-ray

import java.util.*;

public class xray_arup {
	
	final public static long OFFSET = 2000000L;

	public static void main(String[] args) {
	
		Scanner stdin = new Scanner(System.in);
		int nC = stdin.nextInt();
		
		// Process all cases.
		for (int loop=0; loop<nC; loop++) {
			
			// We will store each point two ways - by its sum and difference...
			// This is how we know each point's forward line and backward line.
			HashMap<Integer,Integer> sumMap = new HashMap<Integer,Integer>();
			HashMap<Integer,Integer> diffMap = new HashMap<Integer,Integer>();
			
			int n = stdin.nextInt();

			// Will store sum difference pairs here.
			HashSet<Long> sumDiffPairs = new HashSet<Long>();
			
			// Read in the pts.
			for (int i=0; i<n; i++) {
				
				// Get the next number.
				int x = stdin.nextInt();
				int y = stdin.nextInt();
				int sum = x + y, diff = x - y;
				
				// I store these as longs 10^9 * adjusted sum + adjusted diff.
				sumDiffPairs.add((sum+OFFSET)*1000000000L+(diff+OFFSET));
				
				// Update sum map.
				if (sumMap.containsKey(sum)) 
					sumMap.put(sum, sumMap.get(sum) + 1);
				else 
					sumMap.put(sum , 1);
					
				// Add difference map.
				if (diffMap.containsKey(diff))
					diffMap.put(diff, diffMap.get(diff) + 1);
				else
					diffMap.put(diff, 1);
			}
			
			// I store ALL maximal backward diagonals here.
			int maxSum = 0, maxDiff = 0;
			ArrayList<Integer> maxSumList = new ArrayList<Integer>();
			for (Integer x: sumMap.keySet()) {
				int val = sumMap.get(x);
				if (val > maxSum) {
					maxSum = val;
					maxSumList.clear();
					maxSumList.add(x);
				}
				else if (val == maxSum) {
					maxSumList.add(x);
				}
			}
			
			// All maximal forward diagonals here.
			ArrayList<Integer> maxDiffList = new ArrayList<Integer>();
			for (Integer x: diffMap.keySet()) {
				int val = diffMap.get(x);
				if (val > maxDiff) {
					maxDiff = val;
					maxDiffList.clear();
					maxDiffList.add(x);
				}
				else if (val == maxDiff) {
					maxDiffList.add(x);
				}
			}
			
			boolean safeInter = false;
			
			// Try all pairs of maximal lines.
			for (Integer sum : maxSumList) {
				for (Integer diff : maxDiffList) {
					
					// Check if this intersection point is in the input list.
					long code = (sum+OFFSET)*1000000000L+(diff+OFFSET);
					if (!sumDiffPairs.contains(code)) {
						
						// This means we won't have to subtract one!
						safeInter = true;
						break;
					}
				}
				if (safeInter) break;
			}
			
			// Update result based on sweep of pairs of lines.
			int res = maxSum + maxDiff;
			if (!safeInter) res--;
			
			// Ta da! (We can always pick the intersection of these two diagonals.
			System.out.println(res);
		}
	}
}