#include <bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int N, M;
    cin >> N >> M;
    vector <pair<int,int>> n(N);
    vector <int> m1(M);
    vector <int> m2(M);
    vector <int> m3(M);
    for (int i = 0; i < N; i++) {
        int d, u;
        cin >> d >> u;
        n[i]=make_pair(d,u);
    }
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        m1[i]= --a;
        m2[i]= --b;
        cin >> m3[i];
    }

    for(int i=0;i<M;i++){
        int broj=0;
        while(m1[i] <= m2[i] ){
            if( n[m1[i]].first <= m3[i] && m3[i] <= n[m1[i]].second )broj++;
            //cout << n[m1[i]].first << " " << m3[i] << " " <<  m3[i] << " " << n[m1[i]].second << "\n";
            m1[i]++;
        }
        cout << broj << "\n";
    }

    return 0;
}