#ifndef ONLINE_JUDGE
	#include "debug.cpp"
#endif

#include <bits/stdc++.h>
using namespace std;

#define int long long

void solve()
{
	int n, k;
	cin >> n >> k;
	vector<pair<int, int> > vp;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		vp.push_back({x, y});
	}
	
	int ans = 0;
	bool ok = 0;
	// int cnt = 0;
	for (int i = 0; i < n; i++)
	{
		// bad = 1;
		int cnt = 0;
		for (int j = 0; j < n; j++)
		{
			if (abs(vp[i].first - vp[j].first) + abs(vp[i].second - vp[j].second) <= k)
			{
				cnt++;
			}
		}
		if (cnt == n)
			ok = 1;
		// if (cnt < n)
		// {
		// 	cout << "-1\n";
		// 	return;
		// }
	}
	if (ok)
		cout << "1\n";
	else
		cout << "-1\n";
	// cout << "1\n";
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int t = 1;
    cin >> t;
    while (t--)
        solve();
    return 0;
}