Problem: <image>

After William is done with work for the day, he enjoys playing his favorite video game.

The game happens in a 2D world, starting at turn 0. William can pick any cell in the game world and spawn in it. Then, each turn, William may remain at his current location or move from the current location (x, y) to one of the following locations: (x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1).

To accelerate movement the game has n fast travel towers. i-th tower is located at location (xa_i, ya_i). To be able to instantly travel to the tower from any location in the game world it must first be activated. Activation of tower i happens at the moment when the player is in cell (xa_i, ya_i) after this the tower remains active throughout the entire game.

William also knows that the game has m quests. i-th quest can be completed instantly by being at location (xb_i, yb_i) on turn t_i.

William wants to find out the maximal number of quests he will be able to complete by optimally traversing the game world.

Input

The first line contains two integers n and m (0 ≤ n ≤ 14, 1 ≤ m ≤ 100), which are the number of towers and the number of quests, respectively.

Each of the next n lines contains two integers xa_i, ya_i (1 ≤ xa_i, ya_i ≤ 10^6), which are the coordinates of fast travel towers.

Each of the next m lines contains two integers xb_i, yb_i and t_i (1 ≤ xb_i, yb_i ≤ 10^6, 1 ≤ t_i ≤ 10^9), which are the coordinates of quests and the turn at which it may be completed.

It is guaranteed that all locations in a test are different.

Output

Print a single number — the maximal number of quests William will be able to complete.

Example

Input


3 4
1 1
2 3
5 2
2 2 12
5 1 4
6 2 11
3 5 10


Output


3

Note

In the first sample test one of the possible sequences of William's actions is as follows: 

  * Spawn at (3, 2) 
  * On turn 1 move to (4, 2) 
  * On turn 2 move to (5, 2). By visiting this cell William activates tower number 3. 
  * On turn 3 move to (5, 1), where he waits for 1 turn to complete the 2nd quest 
  * On turn 5 move to (5, 2) 
  * On turn 6 move to (5, 3) 
  * On turn 7 move to (5, 4) 
  * On turn 8 move to (5, 5) 
  * On turn 9 move to (4, 5) 
  * On turn 10 move to (3, 5). By moving to this location William will complete the 4th quest 
  * On turn 10 instantly move to an already activated fast travel tower at (5, 2) 
  * On turn 11 move to (6, 2). By moving to this location William will complete the 3rd quest 
  * William will not be able to complete the quest number 1, because the tower at (2, 3) was not activated 

Solution (in CPP):

Solution:
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif

#include <cassert>
#include <cstring>
#include <cstdint>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <random>
#include <queue>

using namespace std;


#ifdef LOCAL
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
clock_t __my_start_clock = clock();
#else
#define eprintf(...)
#endif

#define TIMESTAMP(x) eprintf("["#x"] Time : %.3lf s.\n", (clock() - __my_start_clock)*1.0/CLOCKS_PER_SEC)
#define TIMESTAMPf(x, ...) eprintf("[" x "] Time : %.3lf s.\n", __VA_ARGS__, (clock() - __my_start_clock)*1.0/CLOCKS_PER_SEC)

#ifdef LOCAL
#define DBG if (1) cerr
#else
#define DBG if (0) cerr
#endif

template<typename T>
bool update_max(T &a, T b) {
  if (a <= b) {
    a = b;
    return true;
  } else {
    return false;
  }
}

template<typename T>
bool update_min(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  } else {
    return false;
  }
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << "[";
  for (const auto &x : v) {
    out << x << " ";
  }
  out << "]";
  return out;
}

#ifdef LOCAL
static struct __timestamper {
  string what;
  __timestamper(const char* what) : what(what){};
  __timestamper(const string& what) : what(what){};
  ~__timestamper(){
    TIMESTAMPf("%s", what.data());
  }
} __TIMESTAMPER("end");
#else
struct __timestamper {
};
#endif

using ll = long long;

const int P = int(1e9) + 7;

int sum(int a, int b) {
  a += b;
  if (a >= P) {
    a -= P;
  }
  return a;
}

int &add(int &a, int b) {
  return a = sum(a, b);
}

int diff(int a, int b) {
  a -= b;
  if (a < 0) {
    a += P;
  }
  return a;
}

int prod(int a, int b) {
  return ll(a) * b % P;
}

int power(int a, int n) {
  int b = 1;
  while (n) {
    if (n & 1) {
      b = prod(a, b);
    }
    a = prod(a, a);
    n /= 2;
  }
  return b;
}

int inv(int a) {
  return power(a, P - 2);
}

int divide(int a, int b) {
  return prod(a, inv(b));
}

using pii = std::pair<int, int>;

#ifdef LOCAL
//#define GEN
#define INTERACT
#endif

struct Point {
  int x, y;

  int distTo(const Point &p) const {
    return abs(x - p.x) + abs(y - p.y);
  }
};

struct Quest {
  Point p;
  int t;
};

struct State {
  int time;
  int cnt;
  int mask;

  bool operator < (const State &st) const {
    if (time != st.time) {
      return time < st.time;
    }
    if (cnt != st.cnt) {
      return cnt < st.cnt;
    }
    return mask < st.mask;
  }
};

const int INF = (1 << 30);

bool solve() {
  int n, m;
  if (scanf("%d%d", &n, &m) != 2) {
    return false;
  }

  vector<Point> tower(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &tower[i].x, &tower[i].y);
  }
  vector<Quest> quest(m);
  for (int i = 0; i < m; ++i) {
    scanf("%d%d%d", &quest[i].p.x, &quest[i].p.y, &quest[i].t);
  }

  sort(quest.begin(), quest.end(), [](const Quest &q1, const Quest &q2) {
    return q1.t < q2.t;
  });

  auto calcMinDist = [&](int mask, const Point &p) {
    int minD = INF;
    for (int k = 0; k < n; ++k) {
      if (mask & (1 << k)) {
        minD = min(minD, p.distTo(tower[k]));
      }
    }
    return minD;
  };

  vector<vector<int>> distToTower(1 << n, vector<int>(n, INF));
  vector<vector<int>> distToQuest(1 << n, vector<int>(m, INF));
  for (int mask = 1; mask < (1 << n); ++mask) {
    for (int i = 0; i < n; ++i) {
      if (mask & (1 << i)) { continue; }
      distToTower[mask][i] = calcMinDist(mask, tower[i]);
    }
    for (int i = 0; i < m; ++i) {
      distToQuest[mask][i] = calcMinDist(mask, quest[i].p);
    }
  }


  vector<vector<int>> dpTowers(1 << n, vector<int>(m + 1, INF));
  vector<vector<int>> dpLastQuest(1 << n, vector<int>(m, -INF));

  auto updateDpTowers = [&](int active_tower_mask, int done_quests, int min_time) {
    if (dpTowers[active_tower_mask][done_quests] > min_time) {
      dpTowers[active_tower_mask][done_quests] = min_time;
    }
  };

  auto updateDpLastQuest = [&](int active_mask_tower, int last_quest, int done_quests) {
    if (dpLastQuest[active_mask_tower][last_quest] < done_quests) {
      dpLastQuest[active_mask_tower][last_quest] = done_quests;
    }
  };

  for (int i = 0; i < n; ++i) {
    updateDpTowers((1 << i), 0, 0);
  }

  for (int i = 0; i < m; ++i) {
    updateDpLastQuest(0, i, 1);
  }

  for (int active_tower_mask = 0; active_tower_mask < (1 << n); ++active_tower_mask) {
    for (int done_quests = 0; done_quests <= m; ++done_quests) {
      if (dpTowers[active_tower_mask][done_quests] == INF) { continue; }
      eprintf("mask %d done %d => time %d\n", active_tower_mask, done_quests, dpTowers[active_tower_mask][done_quests]);
      for (int new_tower = 0; new_tower < n; ++new_tower) {
        if (active_tower_mask & (1 << new_tower)) { continue; }
        updateDpTowers(active_tower_mask | (1 << new_tower), done_quests,
                       dpTowers[active_tower_mask][done_quests] + distToTower[active_tower_mask][new_tower]);
      }
      for (int last_quest = 0; last_quest < m; ++last_quest) {
        if (dpTowers[active_tower_mask][done_quests] + distToQuest[active_tower_mask][last_quest] <= quest[last_quest].t) {
          updateDpLastQuest(active_tower_mask, last_quest, done_quests + 1);
        }
      }
    }

    for (int last_quest = 0; last_quest < m; ++last_quest) {
      if (dpLastQuest[active_tower_mask][last_quest] < 0) { continue; }
      eprintf("mask %d last %d => done %d\n", active_tower_mask, last_quest, dpLastQuest[active_tower_mask][last_quest]);
      for (int new_tower = 0; new_tower < n; ++new_tower) {
        if (active_tower_mask & (1 << new_tower)) { continue; }
        auto need_time = min(distToTower[active_tower_mask][new_tower], quest[last_quest].p.distTo(tower[new_tower]));
        updateDpTowers(active_tower_mask | (1 << new_tower), dpLastQuest[active_tower_mask][last_quest],
                       quest[last_quest].t + need_time);
      }
      for (int next_quest = last_quest + 1; next_quest < m; ++next_quest) {
        auto need_time = min(distToQuest[active_tower_mask][next_quest], quest[last_quest].p.distTo(quest[next_quest].p));
        if (quest[last_quest].t + need_time <= quest[next_quest].t) {
          updateDpLastQuest(active_tower_mask, next_quest, dpLastQuest[active_tower_mask][last_quest] + 1);
        }
      }
    }
  }

  int ans = 0;
  for (int active_tower_mask = 0; active_tower_mask < (1 << n); ++active_tower_mask) {
    for (int last_quest = 0; last_quest < m; ++last_quest) {
      ans = max(ans, dpLastQuest[active_tower_mask][last_quest]);
    }
  }
  printf("%d\n", ans);

  return true;
}

int main() {
#ifdef LOCAL
  freopen("../sample.txt", "r", stdin);
#endif

#ifdef GEN
  int tt = 100;
#else
  int tt = -1;
//  scanf("%d", &tt);
#endif
  for (int ii = 1; ii <= tt || tt == -1; ++ii) {
    if (!solve()) {
      break;
    }
    TIMESTAMPf("Case #%d", ii);
  }
  return 0;
}