#include <iostream>

using namespace std;
bool pripada(int d, int g, int x){
    if(x>=d&&x<=g){
        return true;
    }
    return false;
}
int main()
{
    int n,m;
    cin>>n>>m;
    int d[n], u[n];
    for(int i = 0; i<n; i++){
        cin>>d[i]>>u[i];
    }
    int l[m], r[m], x[m];
    for(int i = 0; i<m; i++){
        cin>>l[i]>>r[i]>>x[i];
    }
    for(int i = 0; i<m; i++){
        int cnt = 0;
        l[i]--;
        r[i]--;
        for(; l[i]<=r[i]; l[i]++){
            if(pripada(d[l[i]],u[l[i]],x[i])){
                cnt++;
            }
        }
        cout<<cnt<<endl;
    }
    return 0;
}