#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
	int t;
	cin >> t;
	while (t--) {
		int n, k;
		cin >> n >> k;
		vector< pair<int, int> > a(n);
		for (int i = 0; i < n; i++) cin >> a[i].first >> a[i].second;
 
		int flag = -1;
		for (int i = 0; i < n; i++) {
			bool cont = 0;
			for (int j = 0; j < n; j++) {
				int x = abs(a[j].first - a[i].first) + abs(a[j].second - a[i].second);
				if (x > k) {
					cont = 1;
					break;
				}
			}
			if (!cont) {
				flag = 1;
				break;
			}
		}
 
		cout << flag << '\n';
	}
}