            //    I solemnly swear that I am upto no good //

#include <bits/stdc++.h>
#define sub   freopen("input.txt", "r", stdin);//freopen("output.txt", "w", stdout);
using namespace std;
#define ll long long
#define time cerr << '\n'<<"Time (in s): " << double(clock() - clk) * 1.0 / CLOCKS_PER_SEC << '\n';
#define pb push_back
#define endl "\n"
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define all(x) x.begin(),x.end()
#define mp make_pair
#define ff first
#define ss second
#define NN cout<<"NO"<<endl
#define YY cout<<"YES"<<endl
#define ub upper_bound
#define lb lower_bound
#define A 1000001
#define make(a,b,c) make_pair(a,make_pair(b,c)) 
bool comp(ll a,ll b){
    return a>b;
}


void solve(){
    ll n,q,k;
    // string s;
    cin>>n>>k;
    // n=s.size();
    std::vector<pair<int,int> > ar(n);
    for(int i=0;i<n;i++){
        ll a,b;
        cin>>a>>b;
        ar[i]=mp(a,b);
    }

    for(int i=0;i<n;i++){
        ll cnt=0;
        for(int j=0;j<n;j++){
            ll p=abs(ar[i].ff-ar[j].ff)+abs(ar[i].ss-ar[j].ss);
            if(p<=k){
                cnt++;
            }
        }
        if(cnt==n){
            cout<<1<<endl;
            return;
        }
    }
    cout<<-1<<endl;


}

int main(){ 
    // sub;    
    fast;
    // pre();
    // clock_t clk = clock();
    int t=1;
    cin>>t;
    while(t--){
        solve();
    }
    // time;

    return 0;
}        

                        // Mischief Managed //    
