#include <iostream>
using namespace std;
int main(){
    int cases;
    cin>>cases;
    while(cases--){
        int n,k;
        cin>>n>>k;
        int arr[n][2];
        for(int i = 0 ; i < n ; i++){
            cin>>arr[i][0]>>arr[i][1];
        }
        int check = 0;
        for(int i = 0 ; i < n ; i++){
            check = 0;
            for(int j = 0 ; j < n ; j++){
                if(abs(arr[i][0] - arr[j][0]) + abs(arr[i][1] - arr[j][1]) <= k)
                check++;
            }
            if(check == n){
                break;
            }
            else{
                check = 0;
            }
        }
        if(check)
        cout<<"1"<<endl;
        else
        cout<<"-1"<<endl;
    }
    return 0;
}