#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>
#include <set>
#define ll long long int 
#define pb push_back 
#define F(i,n) for(ll i=0;i<n;i++)
using namespace std;


int main() {
    ll t=1;
    cin>>t;
    while(t--){
        ll n,k;
        cin>>n>>k;
        vector <pair<ll,ll> > v;
        ll x,y;
        F(i,n)
        {
            cin>>x>>y;
            v.pb({x,y});
        }
        ll flag=0;
        F(i,n)
        {
            ll f=0;
            F(j,n)
            {
                if(abs(v[i].first-v[j].first)+abs(v[i].second-v[j].second)>k) f=1;
            }
            if(f==0) {flag=1;}
        }
        if(flag==1) cout<<1;
        else cout<<-1;
        cout<<endl;
    }
}