#include<bits/stdc++.h> 
using namespace std;
 
#define ll long long int
#define absdiff(a,b) (a>b)?a-b:b-a
#define mp make_pair 
#define pb push_back
#define ff first
#define ss second
#define fast  ios_base::sync_with_stdio(false);cin.tie(0);
#define MOD 1000000007
#define ll_MAX 19223372036859
#define endl "\n"
ll fast_expo(ll x,ll p){
  if(p==0) return 1;
  else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} 
  else return (x*(fast_expo(x,p-1))%MOD)%MOD;}

int main(){
  fast
  #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
  #endif
  
  ll t_c; t_c = 1;
  cin >> t_c;

  for(ll t_i = 0; t_i < t_c; ++t_i){
    ll n, k; cin >> n >> k;
    ll ans = -1;

    vector<ll> AdjL[n];
    pair<ll, ll> arr[n];
    for(ll i = 0; i < n; ++i){
      cin >> arr[i].ff >> arr[i].ss;
    }

    for(ll i = 0; i < n; ++i){
      ll flag = 1;
      for(ll j = 0; j < n; ++j){
        ll dis = abs(arr[j].ff - arr[i].ff) + abs(arr[j].ss - arr[i].ss);
        if(dis > k){
          flag = 0;
          break;
        }
      }
      if(flag){
        ans = 1;
        break;
      }
    }
    cout << ans << endl;
  }
  return 0;
}