#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(n) for(int i=0;i<n;i++)
#define rrep(n) for(int i=n-1;i>=0;i--)
#define mod 1000000007
typedef vector<int> vi; 
typedef pair<int, int> pi; 
#define F first 
#define S second 
#define PB push_back
void solve()
{
	ll n,k;
	cin>>n>>k;
	vector<pair<int,int>>v;
    rep(n){
    	int x,y;
    	cin>>x>>y;
    	v.push_back({x,y});
    }
   for(int i=0;i<n;i++)
   {
   	bool ok=true;
   	for(int j=0;j<n;j++)
   	{
   		if(abs(v[i].first-v[j].first)+abs(v[i].second-v[j].second)>k)
   			{
   				ok=false;break;
   			}
   	}
   	if(ok)
   		{
   			cout<<1;return;
   		}
   }
   cout<<-1;

}
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t=1;
	cin>>t;
	while(t--)
	{
	solve();
	cout<<"\n";
	}
	return 0;
}