#include<bits/stdc++.h>
//#pragma GCC optimize(2)
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=a;i>=n;i--)

using namespace std;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0)
#define ll long long
#define ull unsigned long long
#define PII pair<int,int>
#define pb push_back
#define fi first
#define se second
#define all(a) a+1,a+n+1
#define ALL(a) a.begin(),a.end()
#define debug(a) cout <<#a << "=" << a << endl;
const int INF = 0x3f3f3f3f;
const ll LINF = 1ll<<60;
const int mod=1e9+7;
#define TT int T;cin>>T;while(T--)
inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}return x*f;}
inline void write(int x){if(x<0) putchar('-'),x=-x;if(x>9) write(x/10);putchar(x%10+'0');}

void solve(){
	int n,k;
	cin>>n>>k;
	PII a[110];
	rep(i,1,n) cin>>a[i].fi>>a[i].se;
	rep(i,1,n){
		int f=1;
		rep(j,1,n){
			
			if(abs(a[i].fi-a[j].fi)+abs(a[i].se-a[j].se)>k){
				f=0;
				break;
			}
		}
		if(f==1){
			cout<<1<<endl;
			return;
		}
	}
	cout<<-1<<endl;
	return;
}
int main(){
	TT{
		solve();
	}
    return 0;
}
