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



  return 0;
}