#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;
#define ff first
#define ss second
#define pb push_back
#define sz(a) signed(a.size())
#define all(v) v.begin(),v.end()
#define rall(v) (v.rbegin(),v.rend())
#define reunique(v) v.resize(std::unique(v.begin(), v.end()) - v.begin())
#define rep(i,n) for(int i(0);i<n;++i)
#define trav(x, v) for (auto &x : v)
#define OK(ok) cout << (ok ? "YES\n" : "NO\n")

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

template <class T> T sqr(T x) { return x * x; }
template <class T> T abs(T x) { return x < 0? -x : x; }
template <class T> T gcd(T a, T b) { return b? gcd(b, a % b) : a; }
template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

const int MOD=1000000007;
const int PRM=998244353;


void solve(){
	int n,k,u,v,id=-1;
	cin >> n >> k;
	vector<int> x(n),y(n);
	rep(i,n){
		cin >> x[i] >> y[i];
	}

	for(int i(0);i<n;++i){
		bool chk=1;
		for(int j(0);j<n;++j){
			if(j!=i){
				if(abs(x[i]-x[j])+abs(y[i]-y[j]) > k){
					chk=0;break;
				}
			}
		}
		if(chk){
			id=i;break;
		}
	}

	if(id!=-1){
		cout << 1 << endl;
	}
	else{
		cout << -1 << endl;
	}
}

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	#ifdef HOME
    assert(freopen("input.txt", "r", stdin));
    assert(freopen("output.txt", "w", stdout));
    #endif
    int t;
    cin >> t;
    while(t--){
    	solve();
    }

    cerr << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec" << endl;

}