#include <bits/stdc++.h>
using namespace std;
using ld = long double;
using ll = long long;
const ll mod = 1000000007;
#define fo(i,a,b) for(ll i=a;i<b;i++)
#define T ll t; cin>>t; fo(i,0,t)
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";

/*vector<pair<ll, ll> > A;  //sorting map in asc order by val  //use A.begin() after the sort work as map
bool cmp(pair<ll, ll>& a, //if using multiple time dont forget to use A.clear();
         pair<ll, ll>& b) 
{ 
    return a.second < b.second; 
}
void sort(map<ll, ll>& M)  //sort(ma);
{  
    for (auto& it : M) { 
        A.push_back(it); 
    } 
  
    sort(A.begin(), A.end(), cmp);
} 
ll gcd(ll a,ll b){  //b>a
    if(a==0)
      return b;
       gcd(b%a,a);
}
ll isprime(ll n){
    if(n==2)
    return 1;
    if(n<=1)
    return 0;
    for(ll i=2;i<=sqrt(n);i++){
        if(n%i==0)
         return 0;
    }
    return 1;
}
ll fac(ll n){
    if(n==0)
    return 1;
    if(n==1)
    return 1;
    ll i=n,fact=1;
    while(n/i!=n){
        fact=fact*i;
       
        i--;
      
    }
      return fact%mod;
}*/
string dectobin(ll n){
    string str=bitset<32>(n).to_string();  //string length 32
    
    //const auto loc=str.find('1');//index of first '1' starting from 0
    //if(loc!=string::npos)
     //  return str.substr(loc);  
     return str;  
     //  return "0";
}
int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   T{
       ll n,k;  cin>>n>>k;
       ll x[n],y[n];
       fo(i,0,n){
           cin>>x[i]>>y[i];
       }
       ll r=-1;  
           ll c;
       fo(i,0,n){
           fo(j,0,n){  if(i==j)
                         continue;
               if((abs(x[i]-x[j])+abs(y[i]-y[j]))<=k){
                  //r=1; break;
                  c=1;
               }
               else{
                   c=-1; break;
               }
           }
         if(c==1)
           break;
       }
      if(c==1)
        cout<<1;
        else
         cout<<r;
           cout<<'\n';
   } 
   	printclock;
    return 0;
}







 
