#include<bits/stdc++.h>
using namespace std;
long long n,m,l,r,br,br1,x,d[100000005],u[100000005];
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
    cin>>d[i]>>u[i];
}
for(int j=1;j<=m;j++){
    br=0;
    br1=0;
    cin>>l>>r>>x;
    for(int i=l;i<=r;i++){
        if(x>=d[i] and x<=u[i])br++;
        else if(x<d[i] and x>=u[i]){
            br1++;
        }
    }
    //cout<<br1<<endl;
    cout<<br<<endl;
}
return 0;
}