#pragma GCC optimize("Ofast")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define gcd(a,b) __gcd(a,b)
#define pb push_back
#define DRACO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define GO ll t; cin>>t; for(int i = 1 ; i <= t ;i++)
#define mod  1000000007
#define fore(p) for(auto& x:p)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(), x.rend()
#define F first
#define S second 
//check the corner cases(n==1)
//try checking in reverse order
//check your logic again
ll k;
void Solve()
{
	ll i,j,l,n,m;
	cin >> n >> k;
	vector<pair<ll,ll>> v;
	for(i = 0 ; i < n ;i++)
	{	ll x, y;
		cin >> x >> y;
		v.pb({x,y});
	}

	sort(all(v));

	for(i = 0 ; i< n ;i++)
	{	ll f = 1;
		for(j = 0 ; j < n ;j++)
		{
			if(abs(v[i].F-v[j].F) + abs(v[i].S-v[j].S) > k)
			{
				f = 0;
			}
		}
		if(f)
		{
			cout << "1\n";
			return;
		}
	}

	cout << "-1\n";
}
int main() 
{   DRACO
    cout.precision(10);
    #ifndef ONLINE_JUDGE
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif
    GO
    {   	
    	Solve();
    }
return 0;
}