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:
/*
KAMUI!
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 
▓▓▓▓▓▓▓▓▓▓▓▓▓██████████▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 
▓▓▓▓▓▓▓▓▓▓███▓▓▓▓▓▓▓▓▓▓█████▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓▓███▓▒▒░▒▒▒▒▒░░░▒▒▒▓▓███▓▓▓▓▓▓▓ 
▓▓▓▓▓▓█▓▒▒▒▓▓████████▓▒▒░▒▒▒▓██▓▓▓▓▓▓
▓▓▓▓██▒▓████████████████▓░▒▒▒▒▓██▓▓▓▓ 
▓▓▓██▓███████▓▒░░░░░░░▒███▒░░▒▒▒██▓▓▓ 
▓▓█████████▓░░░░░░░░░░░░░██▓▓██████▓▓ 
▓▓█▒▓███████████▓▓▒▒▒▓▓██████████▓█▓▓ 
▓██▒▒▒███████████████████████████▓▓█▓ 
▓█▓▒▒░░████████▒░░░░▓███████████▓░▒█▓ 
▓█▒▒▒░██░▒████░░░░░░█████░░████▓░░▒█▓ 
▓█▒▒▒▒██░░░██▓░░░░░░░███▒░░████▒▒▒▒█▓ 
▓█▓▒▒▒██▒░░░▓█▓░░░░░▓█▓░░░▓███▓▒▒░▓█▓ 
▓█▓▒▒▒███░░░░████████▓░░░░░████▒▒▒▓█▓ 
▓▓█▒▒░▓███░░░▒███████▒░░░▒███▓▒▒▒▒█▓▓ 
▓▓██▒▒░████▒░░███████░░░▓███▓░▒▒▒██▓▓ 
▓▓▓██▒▒▒█████▓░░██████▒▓███▓▒░▒▒██▓▓▓ 
▓▓▓▓██▓▒░▓██████████████▓▒░▒▒▒▓██▓▓▓▓ 
▓▓▓▓▓▓██▓░▒▓█████████▒░░▒▒▒▒▓██▓▓▓▓▓▓ 
▓▓▓▓▓▓▓███▓▒▒▓██████▓░▒▒▒▓▓███▓▓▓▓▓▓▓ 
▓▓▓▓▓▓▓▓▓▓▓███▓▓▓▓███▓▓▓████▓▓▓▓▓▓▓▓▓ 
▓▓▓▓▓▓▓▓▓▓▓▓▓███████████▓▓▓▓▓▓▓▓▓▓▓▓▓ 
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
*/
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
 
using namespace std;
template<typename T1, typename T2> inline bool chkmin(T1 &a, const T2 &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> inline void chkmax(T1 &a, const T2 &b) {if (a < b) a = b;}
#define files(FILENAME) read(FILENAME); write(FILENAME)
#define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout)
#define all(c) (c).begin(), (c).end()
#define sz(c) (int)(c).size()
#define left left228
#define right right228
#define y1 y1228
#define mp make_pair
#define pb push_back
#define y2 y2228
#define rank rank228
using ll = long long;
using ld = long double; 
const string FILENAME = "input";
const int Mod = 1000000007;


int sum(int a, int b) {
    return (a + b >= Mod ? a + b - Mod: a + b);
}


int mul(int a, int b) {
    return ((ll)a * b) % Mod;
}


int powm(int a, int b) {
    int res = 1;
    while (b) {
        if (b & 1) {
            res = mul(res, a);
        }
        a = mul(a, a);
        b >>= 1;
    }
    return res;
}


int inv(int a) {
    return powm(a, Mod - 2);
}



int n, m;
int xa[105], ya[105], xb[105], yb[105];
int dp[105][1 << 14];
int mind[1 << 14];
int res[1 << 14][16];
int res1[1 << 14][105];
vector<pair<int, int> > kt[1 << 14];
vector<int> kt1[1 << 14];
int t[105];
vector<pair<int, int> > need[1 << 14];
int uk[1 << 14];
bool needs[1 << 14];


void solve() {
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        cin >> xa[i] >> ya[i];
    }
    vector<pair<int, int > > st;
    for (int i = 0; i < m; i++) {
        cin >> xb[i] >> yb[i] >> t[i];
        st.pb(mp(t[i], i));
    }
    sort(all(st));
    for (int i = 0; i < (1 << n); i++) {
        mind[i] = 1e9 + 2000;
    }
    mind[0] = 0;
    for (int i = 0; i < n; i++) {
        mind[(1 << i)] = 0;
    }
    for (int i = 0; i < m; i++) {
        for (int mask = 0; mask < (1 << n); mask++) {
            dp[i][mask] = -1e9;
        }
    }
    for (int mask = 0; mask < (1 << n); mask++) {
        vector<int> st;
        for (int j = 0; j < n; j++) {
            if (mask & (1 << j)) {
                st.pb(j);
            }
        }
        for (int j = 0; j < n; j++) {
            res[mask][j] = 1e9 + 2000;
            for (auto x: st) {
                chkmin(res[mask][j], abs(xa[x] - xa[j]) + abs(ya[x] - ya[j]));
            }
        }
    }
    for (int mask = 0; mask < (1 << n); mask++) {
        vector<int> st;
        for (int j = 0; j < n; j++) {
            if (mask & (1 << j)) {
                st.pb(j);
            }
        }
        for (int j = 0; j < m; j++) {
            res1[mask][j] = 1e9 + 2000;
            for (auto x: st) {
                chkmin(res1[mask][j], abs(xa[x] - xb[j]) + abs(ya[x] - yb[j]));
            }
        }
    }
    for (int mask = 0; mask < (1 << n); mask++) {
        for (int j = 0; j < n; j++) {
            if (!(mask & (1 << j))) {
                kt[mask].pb(mp(mask | (1 << j), res[mask][j]));
            }
        }
    }
    for (int mask = 0; mask < (1 << n); mask++) {
        for (int j = 0; j < n; j++) {
            if (!(mask & (1 << j))) {
                kt1[mask].pb(j);
            }
        }
    }
    for (int mask = 0; mask < (1 << n); mask++) {
        for (int j = 0; j < n; j++) {
            if (!(mask & (1 << j))) {
                chkmin(mind[mask | (1 << j)], mind[mask] + res[mask][j]);
            }
        }
    }
    for (int i = 0; i < m; i++) {
        chkmax(dp[i][0], 1);
    }
    for (int mask = 1; mask < (1 << n); mask++) {
        for (int i = 0; i < m; i++) {
            if (st[i].first - mind[mask] >= res1[mask][st[i].second]) {
                chkmax(dp[i][mask], 1);
            }
        }
    }
    // cout << res1[5][8] << ' ' << xb[8] << ' ' << yb[8] << endl;
    int ans = 0;
    for (int mask = 0; mask < (1 << n); mask++) {
        need[mask].clear();
        for (int j = 0; j < m; j++) {
            int val = st[j].first - res1[mask][st[j].second];
            need[mask].pb(mp(val, j));
        }
        sort(all(need[mask]));
    }
    for (int i = 0; i < m; i++) {
        for (int j = i + 1; j < m; j++) {
            for (int mask = 0; mask < (1 << n); mask++) {
                if (st[j].first - st[i].first >= min(res1[mask][st[j].second], abs(xb[st[i].second] - xb[st[j].second]) + abs(yb[st[i].second] - yb[st[j].second]))) {
                    chkmax(dp[j][mask], dp[i][mask] + 1);
                }
            }
        }
        for (int mask = 0; mask < (1 << n); mask++) {
            uk[mask] = sz(need[mask]) - 1;
        }
        for (int mask = 0; mask < (1 << n); mask++) {
            mind[mask] = 1e9 + 2000;
        }
        for (int f = i + 1; f >= 1; f--) {
            bool was = false;
            for (int mask = 0; mask < (1 << n); mask++) {
                needs[mask] = false;
            }
            for (int mask = 0; mask < (1 << n); mask++) {
                if (dp[i][mask] == f) {
                    if (chkmin(mind[mask], st[i].first)) {
                        was = true;
                        needs[mask] = true;
                    }
                    for (auto f: kt1[mask]) {
                        if (chkmin(mind[mask | (1 << f)], st[i].first + abs(xb[st[i].second] - xa[f]) + abs(yb[st[i].second] - ya[f]))) {
                            was = true;
                            needs[mask | (1 << f)] = true;
                        }
                    }
                }
            }
            if (was) {
                for (int mask = 0; mask < (1 << n); mask++) {
                    if (mind[mask] > 1e9 + 5) {
                        continue;
                    }
                    if (!needs[mask]) {
                        continue;
                    }
                    for (const auto &jj: kt[mask]) {
                        if (chkmin(mind[jj.first], mind[mask] + jj.second)) {
                            needs[jj.first] = true;
                        }
                    }
                }
                for (int mask = 0; mask < (1 << n); mask++) {
                    while (uk[mask] >= 0 && need[mask][uk[mask]].first >= mind[mask]) {
                        chkmax(dp[need[mask][uk[mask]].second][mask], f + 1);
                        uk[mask]--;
                    }   
                }
            }
        }
        for (int mask = 0; mask < (1 << n); mask++) {
            chkmax(ans, dp[i][mask]);
        }
    } 
    cout << ans << '\n';
}


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