#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define PB push_back
#define PF push_front
#define MK make_pair
#define MT make_tuple
#define REP(i, a, b) for (int i = a; i <= b; i++)
#define MOD 1000000007
#define DEB(x) cout << #x << "=" << x << endl
#define DEB2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int T = 1, n, k;
  cin >> T;
  while (T--) {
    cin >> n >> k;
    int X[n], Y[n];
    REP(i, 0, n - 1) { cin >> X[i] >> Y[i]; }
    bool anypos = false;
    REP(i, 0, n - 1) {
      bool ispos = true;
      REP(j, 0, n - 1) {
        if (abs(X[i] - X[j]) + abs(Y[i] - Y[j]) > k) {
          ispos = false;
          break;
        }
      }
      if (ispos) {
        cout << 1 << endl;
        anypos = true;
        break;
      }
    }
    if (!anypos)
      cout << -1 << endl;
  }

  return 0;
}
