#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<utility>
#include<list>
#include<queue>
#include<set>
#include<cmath>
#include<map>
#include<bitset>
using namespace std;
#define int long long
#define  nl <<"\n"
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<char> vc;
typedef pair<int, int> pi;
typedef vector<pair<int, int> > vpi;

template<typename T> ostream& operator<<(ostream& stream, vector<T>& v)
{
    for (T& x : v) stream << x << " "; return stream;
}
template<typename T> istream& operator>>(istream& stream, vector<T>& v)
{
    for (T& x : v) stream >> x; return stream;
}
template<typename T> void sort(vector<T>& v)
{
    std::sort(v.begin(), v.end());
    return;
}
template<typename T> T max(vector<T>& v)
{
    return *(max_element(v.begin(), v.end()));
}
template<typename T> T min(vector<T>& v)
{
    return *(min_element(v.begin(), v.end()));
}



void solve()
{
    int n,k;
    cin>>n>>k;
    vpi a(n);
    for (size_t i = 0; i < n; i++)
    {
        int x,y;
        cin>>x>>y;
        a[i]={x,y};
    }
    for (size_t i = 0; i < n; i++)
    {
        int count=1;
        for (size_t j = 0; j < n; j++)
        {
            if(abs(a[i].first-a[j].first)+abs(a[j].second-a[i].second)>k)
            {
                count=0;
                continue;
            }
        }
        if(count)
        {
            cout<< 1 nl;
            return;
        }
        
    }
    cout<<-1 nl;
    
    
    

}


signed main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    cin >> t;
    while (t--)
    {

        solve();

    }
    return 0;

}
