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