#include <bits/stdc++.h>

#define ll long long
#define ull unsigned ll
#define ld long double
#define pb push_back
#define ppb pop_back
#define clr clear
#define len size()
#define beg begin()
#define end end()
#define ins insert
#define f first
#define s second
#define mp make_pair
#define forn(i, l, r) for(ll i = l; i <= r; ++i)
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)

using namespace std;

int t, n, k;

const int MAXN = 110;

int d[MAXN][MAXN], x[MAXN], y[MAXN];
vector < int > g[MAXN];

int main()
{
	fastio;

	cin >> t;

	while (t--)
	{
		cin >> n >> k;

		for (int i = 1; i <= n; ++i)
		{
			cin >> x[i] >> y[i];
			g[i].clr();
		}

		for (int i = 1; i < n; ++i)
		{
			for (int j = i + 1; j <= n; ++j)
				d[i][j] = d[j][i] = abs(x[i] - x[j]) + abs(y[i] - y[j]);
		}

		for (int i = 1; i < n; ++i)
		{
			for (int j = i + 1; j <= n; ++j)
			{
				if (d[i][j] <= k)
				{
					g[i].pb(j);
					g[j].pb(i);
				}
			}
		}

		int ans = -1;
		for (int i = 1; i <= n; ++i)
		{
			if ((int)g[i].len == n - 1)
			{
				ans = 1;
				break;
			}
		}

		cout << ans << "\n";
	}

	return 0;
}