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 <bits/stdc++.h>
#include <random>
#define ll long long int
#define pb push_back
#define st first
#define nd second
#define pii pair<int,int>
#define mp make_pair
#define pll pair<long long,long long>
#define ld long double
#define ull unsigned long long

using namespace std;
const int nax = 105;

int min_time[nax][1 << 14];
int max_done[nax][1 << 14];
int min_dist[14][1 << 14];

int n,m;
int x[15];
int y[15];
vector<pair<int, pii> > quests;


int done[1 << 14];
int LO[1 << 14];
int HI[1 << 14];

void propagate(int nxt){
    for(int mask=1;mask<(1<<n);mask++){
        LO[mask] = done[mask];
        int wsk = done[mask];
        while(wsk < m && min_time[wsk][mask] < nxt){
            for(int c=0;c<n;c++){
                if(!(mask & (1 << c))){
                    min_time[wsk][mask ^ (1 << c)] = min(min_time[wsk][mask ^ (1 << c)], min_time[wsk][mask] + min_dist[c][mask]);
                }
            }
            wsk++;
        }
        done[mask] = wsk;
        HI[mask] = wsk - 1;
    }

    /*for(int i=0;i<m;i++){
        for(int j=1;j<(1<<n);j++){
            for(int c=0;c<n;c++){
                if(!(j & (1 << c))){
                    min_time[i][j ^ (1 << c)] = min(min_time[i][j ^ (1 << c)], min_time[i][j] + min_dist[c][j]);
                }
            }
        }
    }
    */
}

int dist_tow[nax][1 << 14];
int cost[nax][nax];

void solve(){
    cin >> n >> m;
    for(int i=0;i<n;i++) cin >> x[i] >> y[i];
    for(int i=0;i<m;i++){
        int xb, yb, t;
        cin >> xb >> yb >> t;
        quests.pb(mp(t, mp(xb, yb)));
    }
    sort(quests.begin(), quests.end());
    for(int i=0;i<m;i++){
        for(int j=i+1;j<m;j++){
            cost[i][j] = abs(quests[i].nd.st - quests[j].nd.st) + abs(quests[i].nd.nd - quests[j].nd.nd);
        }
    }
    for(int i=0;i<n;i++){
        for(int j=1;j<(1<<n);j++){
            if(j & (1 << i)) continue;
            int mini = 2e9 + 5;
            for(int k=0;k<n;k++){
                if(j & (1 << k)){
                    mini = min(mini, abs(x[k] - x[i]) + abs(y[k] - y[i]));
                }
            }
            min_dist[i][j] = mini;
        }
    }
    for(int i=0;i<nax;i++){
        for(int j=0;j<(1<<14);j++){
            min_time[i][j] = 2e9;
            max_done[i][j] = -2e9;
        }
    }

    for(int i=0;i<m;i++){
        max_done[i][0] = 1;
    }
    for(int i=0;i<n;i++){
        min_time[0][1 << i] = 0;
    }

    for(int i=0;i<m;i++){
        int xx = quests[i].nd.st;
        int yy = quests[i].nd.nd;
        for(int j=1;j<(1<<n);j++){
            int mini = 2e9 + 5;
            for(int k=0;k<n;k++){
                if(j & (1 << k)){
                    mini = min(mini, abs(xx - x[k]) + abs(yy - y[k]));
                }
            }
            dist_tow[i][j] = mini;
        }
    }

    int ans = 0;
    for(int i=0;i<m;i++){
        // situation before i - th quest
        propagate(quests[i].st);
        // propagate dp towers
        //cout << "AC" << min_time[0][63] << endl;
        //
        int ti = quests[i].st;
        for(int j=1;j<(1<<n);j++){
            for(int k=LO[j];k<=HI[j];k++){
                if(min_time[k][j] + dist_tow[i][j] <= ti){
                    max_done[i][j] = max(max_done[i][j], k + 1);
                }
                for(int to=i+1;to<m;to++){
                    if(min_time[k][j] + dist_tow[to][j] <= quests[to].st){
                        max_done[to][j] = max(max_done[to][j], k + 1);
                    }
                }
            }
            ans = max(ans, max_done[i][j]);
        }
        ans = max(ans, max_done[i][0]);
        // update quest_best
        //

        // propagate quest_best (to next_quests and to next_towers)

        for(int j=1;j<(1<<n);j++){
            for(int to=i+1;to<m;to++){
                int dif = quests[to].st - ti;
                if(dif >= cost[i][to]){
                    max_done[to][j] = max(max_done[to][j], max_done[i][j] + 1);
                }
            }
            int ok = max_done[i][j];
            if(ok < 0) continue;
            for(int c=0;c<n;c++){
                if(!(j & (1 << c))){
                    int di = abs(quests[i].nd.st - x[c]) + abs(quests[i].nd.nd - y[c]);
                    di = min(di, min_dist[c][j]);
                    min_time[ok][j ^ (1 << c)] = min(min_time[ok][j ^ (1 << c)], ti + di);
                }
            }
            min_time[ok][j] = min(min_time[ok][j], ti);
        }
        int j = 0;
        for(int to=i+1;to<m;to++){
            int dif = quests[to].st - ti;
            if(dif >= cost[i][to]){
                max_done[to][j] = max(max_done[to][j], max_done[i][j] + 1);
            }
        }
        int ok = max_done[i][j];
        if(ok < 0) continue;
        for(int c=0;c<n;c++){
            if(!(j & (1 << c))){
                int di = abs(quests[i].nd.st - x[c]) + abs(quests[i].nd.nd - y[c]);
                min_time[ok][j ^ (1 << c)] = min(min_time[ok][j ^ (1 << c)], ti + di);
            }
        }
    }

    cout << ans << "\n";
}


int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    solve();

    return 0;
}