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.
//package CodeForces;

import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import javafx.util.Pair;

public class Main {

    public static MyScanner sc = new MyScanner();
    public static int MOD = 1000000007;
    // __builtin_popcountll(n) <-- c++ // binary count(1) ex. 8 --> 0100 --> 1
    HashSet<Integer> set = new HashSet<>();
    HashMap<Integer, Integer> map = new HashMap<>();
    Random r = new Random();
    ArrayList<Integer> l = new ArrayList<>();
    LinkedList<Integer> link = new LinkedList<>();
    public static int[][] dp;

    /* ********************************* main ********************************* */
    public static void main(String[] args) {
        int t = 1;
        t = sc.nextInt();
        while(t-->0){
            int n = sc.nextInt();
            int k = sc.nextInt();
            ArrayList<MyPair> l = new ArrayList<>();
            for (int i = 0; i < n; i++) l.add(new MyPair(sc.nextInt(), sc.nextInt()));
            boolean ok = false;
            for (int i = 0, c = 0; i < n && !ok; i++, c = 0) {
                for (int j = 0; j < n; j++) {
                    int dif1 = Math.abs(l.get(i).x - l.get(j).x);
                    int dif2 = Math.abs(l.get(i).y - l.get(j).y);
                    if(dif1 + dif2 <= k) c++;
                }
                if(c == n) ok = true;
            }
            System.out.println(ok ? 1 : -1);
        }
    }
    /* ********************************* End ********************************* */

    public static ArrayList<Integer> factorize(Long n){
        HashSet<Integer> set = new HashSet<>();
        while(n%2 == 0){
            set.add(2);
            n /= 2;
        }
        for (int i = 3; i <= Math.sqrt(n); i = i + 2) {
            while (n % i == 0) {
                set.add(i);
                n /= i;
            }
        }
        ArrayList<Integer> l = new ArrayList<>(set);
        return l;
    }
    
    public static boolean contain(Queue q1, Queue q2, int i){
        return containQ1(q1, q2, q1.size() - 1) && containQ2(q2, q1, q2.size() - 1);
    }
    
    public static boolean containQ1(Queue q1, Queue q2, int i){
        if(i == -1) return true;
        if(q2.contains(q1.peek())){
            q1.add(q1.remove()); 
            return containQ1(q1, q2, i - 1);
        }
        return false;
    }
    
    public static boolean containQ2(Queue q1, Queue q2, int i){
        if(i == -1) return true;
        if(q2.contains(q1.peek())){
            q1.add(q1.remove()); 
            return containQ2(q1, q2, i - 1);
        }
        return false;
    }
    
    public static void removeLast(ArrayList a, int l){
        if(l == a.size() - 1){
            a.remove(l);
            return;
        }
        removeLast(a, ++l);
    }
    public static double m(int i){
        if(i == 0) return 0;
        if(i == 1) return 1;
        return 1.0/i + m(--i);
    }
    
    public static void reverse(LinkedList a, int l, int r){
        if(l > r) return;
        a.add(l, a.remove(r));
        reverse(a, ++l, r);
    }
        
    public static int BinarySearch(int[] a, int v, int f, int l){
        if(f > l) return -1;
        int mid = (f + l)/2;
        if(a[mid] == v)
            return mid;
        if(v < a[mid])
            return BinarySearch(a, v, f, mid - 1);
        else
            return BinarySearch(a, v, mid + 1, l);
    }
    
    public static int gcdEuclids(int m, int n){
        int r = m % n;
        while (r != 0) {
            m = n;
            n = r;
            r = m % n;
        }
        return n;
    }

    public static int gcd(int m, int n){
        return n != 0 ? gcd(n, m%n) : n;
    }
    
    
    
    public static class MyScanner {

        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static class MyPair {

        int x;
        int y;

        public MyPair(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public String toString() {
            return "[" + x  + ", " + y + "]";
        }
        
    }

    public static int Fibonacci(int n) {
        int[] a = new int[n + 1];
        a[0] = 0;
        a[1] = 1;
        for (int i = 2; i < a.length; i++) {
            a[i] = a[i - 1] + a[i - 2];
        }
        return a[n];
    }

    public static boolean isprime(long n) {
        for (long i = 2; i * i <= n; i++) {
            if (n % i == 0) {
                return false;
            }
        }
        return true;
    }

    public static int[] addarr(int[] a, int n) {
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        return a;
    }

    public static long factt(long n) {
        if (n == 0) {
            return 1;
        }
        return n * factt(n - 1);
    }

    public static long sumDigit(long n) {
        int a = 0;
        while (n != 0) {
            a += n % 10;
            n /= 10;
        }
        return a;
    }

    public static long pow(long n, long p) {
        return p == 0 ? 1 : n * pow(n, p - 1);
    }

    public static long fastpow(long v, long p) {
        if (p == 0) {
            return 1;
        }
        if (p == 1) {
            return v;
        }
        long ans = fastpow(v, p / 2);
        if (p % 2 == 1) {
            return ans * ans * v;
        } else {
            return ans * ans;
        }
    }
    
    public static int LCS(String s1, String s2, int i, int j) {
//        String s1 = sc.next();
//        String s2 = sc.next();
//        dp = new int[s1.length()][s2.length()];
//        System.out.println(LCS(s1, s2, s1.length()-1, s2.length()-1));
        if (i == -1 || j == -1) {
            return 0;
        } else if (dp[i][j] != 0) {
            return dp[i][j];
        } else if (s1.charAt(i) == s2.charAt(j)) {
            return dp[i][j] = 1 + LCS(s1, s2, i - 1, j - 1);
        } else {
            return dp[i][j] = Math.max(LCS(s1, s2, i - 1, j), LCS(s1, s2, i, j - 1));
        }
    }

}