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:
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <array>
#include <random>
#include <cmath>
#include <chrono>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <climits>
#include <stack>
#include <random>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define rep(x, b, e) for(int x=(b); x<(e); ++x)
#define trav(a, x) for(auto& a : x)
#define ford(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define all(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); // use rng() to get unsigned int
// mt19937_64 for random long longs

#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "


const int inf = 1e9 + 10;
const int N = 14, M = 100;
int n, m;
pii a[N];
pair<int, pii> b[M];
int dist[1 << N][M];
int dist2[1 << N][N];
int earliest_in_tower[1 << N][M + 1];
int highest_score_in_quest[1<< N][M];

int d(const pii& a, const pii &b) {
	return abs(a.st - b.st) + abs(b.nd - a.nd);
}

void solve() {
	cin >> n >> m;
	rep(i, 0, n) {
		cin >> a[i].st >> a[i].nd;
	}
	rep(i, 0, m) {
		cin >> b[i].nd.st >> b[i].nd.nd >> b[i].st;
	}
	sort(b, b + m);
	// rep(i, 0, m) {
	// 	printf("(%d, %d) - %d\n", b[i].nd.st, b[i].nd.nd, b[i].st);
	// }	
	rep(mask, 0, 1 << n) rep(j, 0, m + 1) {
		earliest_in_tower[mask][j] = inf;
	}
	memset(&highest_score_in_quest[0][0], -1, sizeof highest_score_in_quest);
	// printf("earliest_in_tower[0][0] = %d\n", earliest_in_tower[0][0]);
	rep(i, 0, n) {
		earliest_in_tower[1 << i][0] = 0;
	}
	rep(i, 0, m) {
		highest_score_in_quest[0][i] = 1;
	}
	rep(mask, 0, 1 << n) {
		rep(quest, 0, m) {
			dist[mask][quest] = inf;
			rep(j, 0, n) if (mask & (1 << j)) {
				dist[mask][quest] = min(dist[mask][quest], d(a[j], b[quest].nd));
			}
		}
		rep(j, 0, n) {
			if (mask & (1 << j)) {
				continue;
			}
			dist2[mask][j] = inf;
			rep(i, 0, n) {
				if (mask & (1 << i)) {
					dist2[mask][j] = min(dist2[mask][j], d(a[i], a[j]));
				}
			}
		}
	}
	int best_res = 0;
	rep(mask, 0, 1 << n) {
		rep(score, 0, m + 1) {
			if (earliest_in_tower[mask][score] == inf) {
				continue;
			}
			// printf("earliest_in_tower[%d][%d] = %d\n", mask, score, earliest_in_tower[mask][score]);
			rep(possible_quest, 0, m) {
				if (b[possible_quest].st <= earliest_in_tower[mask][score]) {
					continue;
				}
				int time_left = b[possible_quest].st - earliest_in_tower[mask][score];
				if (dist[mask][possible_quest] <= time_left) {
					highest_score_in_quest[mask][possible_quest] = max(highest_score_in_quest[mask][possible_quest], 1 + score);
				}
			}
			rep(possible_tower, 0, n) {
				if (mask & (1 << possible_tower)) {
					continue;
				}
				earliest_in_tower[mask | (1 << possible_tower)][score] = min(earliest_in_tower[mask | (1 << possible_tower)][score], earliest_in_tower[mask][score] + dist2[mask][possible_tower]);
			}
		}
		rep(quest, 0, m) {
			if (highest_score_in_quest[mask][quest] == -1) {
				continue;
			}
			// printf("highest_score_in_quest[%d][%d] = %d\n", mask, quest, highest_score_in_quest[mask][quest]);
			best_res = max(best_res, highest_score_in_quest[mask][quest]);
			rep(possible_quest, quest + 1, m) {
				int shortest_dist = min(dist[mask][possible_quest], d(b[quest].nd, b[possible_quest].nd));
				if (b[quest].st + shortest_dist > b[possible_quest].st) {
					continue;
				}
				highest_score_in_quest[mask][possible_quest] = max(highest_score_in_quest[mask][possible_quest], highest_score_in_quest[mask][quest] + 1);
			}
			rep(possible_tower, 0, n) {
				if (mask & (1 << possible_tower)) {
					continue;
				}
				int shortest_dist = min(dist2[mask][possible_tower], d(b[quest].nd, a[possible_tower]));
				earliest_in_tower[mask | (1 << possible_tower)][highest_score_in_quest[mask][quest]] = min(
					earliest_in_tower[mask | (1 << possible_tower)][highest_score_in_quest[mask][quest]],
					b[quest].st + shortest_dist
				);
			}
		}
	}
	cout << best_res << endl;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	int t;
	// cin >> t;
	t = 1;
	while (t--) {
		solve();
	}
}