#include <iostream>

using namespace std;

int main()
{
    int n, m, br=0;
    cin >> n >> m;
    int d[n], g[n];
    for(int i=0; i<n; i++){
        cin >> d[i] >> g[i];
    }
    int l[m], r[m], x[m], brn[m];
    for(int i=0; i<m; i++){
        cin >> l[i] >> r[i] >> x[i];
        for(int j=l[i]-1; j<=r[i]-1; j++){
            if(x[i]>=d[j] && x[i]<=g[j])
                br++;
        }
        brn[i]=br;
        br=0;
    }

    for(int i=0; i<m-1; i++)
        cout << brn[i] << endl;
    cout << brn[m-1];

    return 0;
}