#include<bits/stdc++.h>
using namespace std;
#define inf 1999999999999999999
#define mod 1000000007
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pf push_front
#define bn binary_search
#define pq priority_queue
#define int long long
#define pii pair<int,int>
#define mii map<int,int>
#define umii unordered_map<int,int>
#define um unordered_map
#define vi vector<int>
#define mii map<int,int>
#define si set<int>
#define ft first
#define sc second
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a*(b/gcd(a,b))
#define bp(a) __builtin_popcountll(a)
#define mmst(a,b) memset(a,b,sizeof(a))
#define ld long double
void lc(){cout<<endl;}
int md(int n){return n%mod;}
void solve()
{
	int n;
	ld k;
	cin>>n>>k;
	//k=k*((ld)(sqrt(2)));
	pii p[n];
	for(int i=0;i<n;i++)
	cin>>p[i].ft>>p[i].sc;
	for(int i=0;i<n;i++)
	{
		int mind=0;
		for(int j=0;j<n;j++)
		{
			if(i==j)continue;
			int dis=abs(p[i].ft-p[j].ft)+abs(p[i].sc-p[j].sc);
			mind=max(mind,dis);
		}
		if(mind<=k)
			{
				cout<<"1";
				return;
			}
	}
    cout<<"-1";
	
}
signed main()
{ 
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	cin>>t;
	while(t--)
	{
	  solve();
	  lc();
	}
}