#include<iostream>
#include<stdio.h>
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<utility>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;

ii ar[100];

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int t; cin >> t;
    while(t--){
        int n, k; cin >> n >> k;
        for(int i = 1; i <= n; ++i){
            cin >> ar[i].fi >> ar[i].se;
        }
        for(int i = 1; i <= n; ++i){
            bool cek = true;
            for(int j = 1; j <= n; ++j){
                int dist = abs(ar[i].fi - ar[j].fi) + abs(ar[i].se - ar[j].se);
                if(dist > k)cek = false;
            }
            if(cek){
                cout << 1 << endl;
                break;
            }
            if(i == n)cout << -1 << endl;
        }
    }
    return 0;
}
