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