You have n distinct points (x_1, y_1),…,(x_n,y_n) on the plane and a non-negative integer parameter k. Each point is a microscopic steel ball and k is the attract power of a ball when it's charged. The attract power is the same for all balls.

In one operation, you can select a ball i to charge it. Once charged, all balls with Manhattan distance at most k from ball i move to the position of ball i. Many balls may have the same coordinate after an operation.

More formally, for all balls j such that |x_i - x_j| + |y_i - y_j| ≤ k, we assign x_j:=x_i and y_j:=y_i.

<image> An example of an operation. After charging the ball in the center, two other balls move to its position. On the right side, the red dot in the center is the common position of those balls. 

Your task is to find the minimum number of operations to move all balls to the same position, or report that this is impossible.

Input

The first line contains a single integer t (1 ≤ t ≤ 100) — the number of test cases.

The first line of each test case contains two integers n, k (2 ≤ n ≤ 100, 0 ≤ k ≤ 10^6) — the number of balls and the attract power of all balls, respectively.

The following n lines describe the balls' coordinates. The i-th of these lines contains two integers x_i, y_i (0 ≤ x_i, y_i ≤ 10^5) — the coordinates of the i-th ball.

It is guaranteed that all points are distinct.

Output

For each test case print a single integer — the minimum number of operations to move all balls to the same position, or -1 if it is impossible.

Example

Input


3
3 2
0 0
3 3
1 1
3 3
6 7
8 8
6 9
4 1
0 0
0 1
0 2
0 3


Output


-1
1
-1

Note

In the first test case, there are three balls at (0, 0), (3, 3), and (1, 1) and the attract power is 2. It is possible to move two balls together with one operation, but not all three balls together with any number of operations.

In the second test case, there are three balls at (6, 7), (8, 8), and (6, 9) and the attract power is 3. If we charge any ball, the other two will move to the same position, so we only require one operation.

In the third test case, there are four balls at (0, 0), (0, 1), (0, 2), and (0, 3), and the attract power is 1. We can show that it is impossible to move all balls to the same position with a sequence of operations.
import java.io.*;
import java.util.*;
 
public class Main {
 
	//static int [] arr;
	//static boolean prime[] = new boolean[1000]; 
	//static List<Long> al = new ArrayList<>();
	//static int l;
	//static String s; static StringBuilder sb;
	//static HashSet<L> hs;
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int t = sc.nextInt();
        //int t = 1;\
        // sieve(600);
        while (t-->0) {
        	int n = sc.nextInt();
        	int k = sc.nextInt();
        	int [] x = new int [n];
        	int [] y = new int [n];
        	for(int i = 0 ; i < n ; i++) {
        		x[i] = sc.nextInt(); y[i] = sc.nextInt();
        	}
        	int ans = -1;
        	for(int i = 0 ; i < n ; i++) {
        		boolean flag = true;
        		for(int j = 0 ; j < n ; j++) 
        			if(Math.abs(x[i]-x[j]) + Math.abs(y[i]-y[j])>k)
        				flag = false;
        		if(flag)
        			ans = 1;
        	}

        	out.println(ans);


        	
        	
        
    }
        out.close();
    }
//    public static int solve(int arr[] , int n , int x) {
//    	if(isSorted(arr))
//    		return 0;
//    	int count = 0;
//    	for(int i = 0 ; i < n ; i++) {
//    		for(int j = 0 ; j < n ; j++) {
//    			if(x<arr[i]) {
//    				int temp = arr[i];
//    				arr[i] = x;
//    				x = temp;
//    				count++;
//    				if(isSorted(arr))
//    					return count;
//    			}
//    		}
//    	}
//    	return -1;
//    }
//    public static boolean isSorted (int [] arr) {
//    	for(int i = 0 ; i < arr.length -1 ; i++)
//    		if(arr[i]>arr[i+1])
//    			return false;
//    	return true;
//    }

     


        

    }

//    static void findsubsequences(String s, String ans){
//    	if (s.length() == 0) {
//    		if(ans!="")
//    			if(ans.length()!=l)
//    			al.add(Long.parseLong(ans));
//    		return;
//	}
//
//		// We add adding 1st character in string
//		findsubsequences(s.substring(1), ans + s.charAt(0));
//		
//		// Not adding first character of the string
//		// because the concept of subsequence either
//		// character will present or not
//		findsubsequences(s.substring(1), ans);
//}
    

    

    
//    static void sieve(int n) 
//    { 
//        // Create a boolean array "prime[0..n]" and initialize 
//        // all entries it as true. A value in prime[i] will 
//        // finally be false if i is Not a prime, else true. 
//        
//        for(int i=0;i<n;i++) 
//            prime[i] = true; 
//          
//        for(int p = 2; p*p <=n; p++) 
//        { 
//            // If prime[p] is not changed, then it is a prime 
//            if(prime[p] == true) 
//            { 
//                // Update all multiples of p 
//                for(int i = p*p; i <= n; i += p) 
//                    prime[i] = false; 
//            } 
//        } 
//    }
 //Print all prime numbers 
//        for(int i = 2; i <= n; i++) 
//        { 
//            if(prime[i] == true) 
//                System.out.print(i + " "); 
//        } 
    

 

    

	class Pair  implements Comparable <Pair>{
		int a ;
		int b ;
		public Pair(int a , int b) {
			this.a = a;
			this.b = b;
		}
		@Override
		public int compareTo(Pair o) {
			// TODO Auto-generated method stub
			return this.a-o.a;
		}
		public String toString() {
			return "( " + this.a + " , " + this.b + " )\n";
		}
		
	}

	
	
	
	
	 class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public int[][] nextInt2DArr(int l, int w) throws IOException {
			int [][] arr = new int[l][w];
			for(int i = 0 ; i < l ; i++)
				for(int j = 0 ; j<w ; j++)
				arr[i][j]= Integer.parseInt(next());
			return arr;
		}

		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		public int[] nextIntArr(int length) throws IOException {
			int[] arr = new int[length];
			for(int i = 0 ; i < length ; i++)
				arr[i] = Integer.parseInt(next());
			return arr;
		}
		public boolean ready() throws IOException {
			return br.ready();
		}
	 }
	