#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
#define fb(i,a,b) for(int (i) = (a); (i) >= (b); --(i))
#define mod 998244353
#define xx first
#define yy second
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define ll long long
#define pii pair<int,int>


using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;/// find_by_order(x)(x+1th) , order_of_key() (strictly less)
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());


int n,m;
pii vage[200005];
struct upit{
    int x;
    int idx;
    int koef;
};
vector<upit> v[200005];

int lst=-1;
int br=1;
vector<int> svi;
map<int,int> poj;


ll bit[200005];
void update(int x, int val){
    while(x <= br){
        bit[x] += val;
        x += (x&-x);
    }
}
ll kveri(int x){
    int ans = 0;
    while(x > 0){
        ans += bit[x];
        x -= (x&-x);
    }
    return ans;
}

int odg[200005];

int main()
{

    ios_base::sync_with_stdio(false); cin.tie(0);

    cin >> n >> m;
    ff(i,1,n){cin >> vage[i].xx >> vage[i].yy; svi.pb(vage[i].xx); svi.pb(vage[i].yy);}
    ff(i,1,m){
        int l,r,x;
        cin >> l >> r >> x;
        v[r].pb({x,i,1});
        v[l-1].pb({x,i,-1});
        svi.pb(x);
    }

    sort(svi.begin(), svi.end());
    for(auto c:svi){
        if(c == lst)continue;
        lst = c;
        poj[c] = br++;
    }

    ff(i,1,n)vage[i] = {poj[vage[i].xx], poj[vage[i].yy]};

    ff(i,1,n){
        update(vage[i].xx,1);
        update(vage[i].yy+1,-1);
        for(auto c:v[i]){

            int koji = poj[c.x];
            odg[c.idx] += c.koef*kveri(koji);
        }
    }
    ff(i,1,m)cout << odg[i] << "\n";

    return 0;
}
/*
3 1
21 34
100 100
56 78
1 2 100
*/