#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double dd;
#define f(i,k,n) for(ll i=k;i<n;i++)
#define all(s) s.begin(),s.end()
#define vec vector<ll>
#define pb push_back
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
void test(){
    ll n,k,ans=1,till=0;
    cin>>n>>k;
    vector<pair<ll,ll> > v;

    bool ok=true;
    f(i,0,n){
        ll a,b;
        cin>>a>>b;
        v.pb({a,b});
    }
    sort(all(v));
    f(i,0,n){
        f(j,0,n){
            if(i!=j) till=max(till,abs(v[j].first-v[i].first)+abs(v[j].second-v[i].second));
        }
        if(till<=k) ok=false;
        till=0;
    }
    ok?cout<<-1<<endl:cout<<1<<endl;
}
int main(){
	IOS;
	ll t=1;cin>>t;
	while(t--){
        test();
	}

	return 0;
}
