#include<bits/stdc++.h>

using namespace std;
int main(){
    int t, n, k;
    cin>> t;

    while(t--){
        cin >> n >> k;
        int res = -1;
        vector<pair<int, int> > pts(n);
        int x , y;
        for (int i = 0; i < n; i++){
            cin >> x >> y;
            pts[i] = make_pair(x, y);
        }

        for (int i = 0; i < n; i++){
            int cnt = 0;
            for (int j = 0; j < n; j++){
                if (abs(pts[i].first - pts[j].first) + abs(pts[i].second - pts[j].second) <= k)
                    cnt++;
            }
            if (cnt == n)
                res = 1;
        }

        cout << res << endl;
    }

    return 0;
}