using namespace std;

#include <iostream>
#include <set>
#include <queue>
#include <cstring>

#define MAXN 105

int arrX[MAXN],arrY[MAXN],degree[MAXN],important[MAXN];
bool edges[MAXN][MAXN],visited[MAXN];

int main() {
	int T;
	cin >> T;
	while(T--) {
		int N,K;
		cin >> N >> K;
		int counter = N;
		for(int i = 0;i < N;++i) {
			cin >> arrX[i] >> arrY[i];
		}
		memset(edges,0,sizeof(edges));
		for(int i = 0;i < N;++i) {
			for(int j = 0;j < N;++j) {
				if(i == j) continue;
				if(abs(arrX[i] - arrX[j]) + abs(arrY[i] - arrY[j]) <= K) {
					edges[i][j] = true;
					degree[i]++;
				}
			}
		}
		int curMax = 0;
		bool ans = false;
		for(int i = 0;i < N;++i) {
			int counter = 0;
			for(int j = 0;j < N;++j) {
				if(edges[i][j]) counter++;
			}
			if(counter == N - 1) {
				ans = true;
				break;
			}
		}
		cout << 2 * ans - 1 << endl;
	}
}