#include<bits/stdc++.h>
#define LIMIT 10000000
using namespace std;
char buffer[LIMIT], *POS;
bool kraj;

inline int getint() { /// samo pozitivni
  char cc;
  while ((cc=*POS++)<'0');
  unsigned long long num = cc - '0';
  while ((cc=*POS++)>='0') num = num * 10 + cc - '0';
  return num;
}
int N,M,d[200005],u[200005],D[23][265005],U[23][265005];
int pos,pos1,pos11,pos2,pos22,NN,nn,pok,Upok[23][265005],Dpok[23][265005];
struct slog{
  int id,x,l,r,sol;
}upit[200005];
bool cmpx1(slog a,slog b){
  return a.x<b.x;
}
bool cmpx2(slog a,slog b){
  return a.x>b.x;
}
bool cmpid(slog a,slog b){
  return a.id<b.id;
}
int seg1(int l,int r,int L,int R,int x,int dubina){
  if(l<L or r>R or l>r)return 0;
  if(l==L and r==R){
    pok=Upok[dubina][L];
    while(U[dubina][pok]<x and pok<=R)pok++;
    Upok[dubina][L]=pok;
    return pok-L;
  }
  int m=(L+R)/2;
  int ret1=seg1(l,min(r,m),L,m,x,dubina-1);
  int ret2=seg1(max(l,m+1),r,m+1,R,x,dubina-1);
  return ret1+ret2;
}
int seg2(int l,int r,int L,int R,int x,int dubina){
  if(l<L or r>R or l>r)return 0;
  if(l==L and r==R){
    pok=Dpok[dubina][L];
    while(D[dubina][pok]>x and pok<=R)pok++;
    Dpok[dubina][L]=pok;
    return pok-L;
  }
  int m=(L+R)/2;
  int ret1=seg2(l,min(r,m),L,m,x,dubina-1);
  int ret2=seg2(max(l,m+1),r,m+1,R,x,dubina-1);
  return ret1+ret2;
}
int main(){
	//freopen("vage.in","r",stdin);
  fread(buffer, 1, LIMIT, stdin);
  POS=buffer;
  N=getint();
  M=getint();
  for(int i=1; i<=N; i++){
    d[i]=getint();
    u[i]=getint();
  }
  for(int i=1; i<=265000; i++)U[0][i]=1e9+5;
  for(int i=1; i<=265000; i++)D[0][i]=-1;
  for(int i=0; i<=20; i++)
    for(int j=1; j<=265000; j++)
      Upok[i][j]=Dpok[i][j]=j;

  for(int i=1; i<=N; i++)U[0][i]=u[i];
  for(int i=1; i<=N; i++)D[0][i]=d[i];
  int stepen=0;
  int stepen2=1;
  while(stepen2<=N){
    stepen2=1<<stepen;
    stepen++;
    for(int i=1; i<=N; i+=stepen2*2){
      pos  =i;
      pos1 =i;
      pos11=i+stepen2-1;
      pos2 =i+stepen2;
      pos22=i+stepen2*2-1;
      while(pos1<=pos11 and pos2<=pos22){
        U[stepen][pos++]=min(U[stepen-1][pos2],U[stepen-1][pos1]);
        if(U[stepen-1][pos2]<U[stepen-1][pos1])pos2++;
        else pos1++;
      }
      while(pos1<=pos11)U[stepen][pos++]=U[stepen-1][pos1++];
      while(pos2<=pos22)U[stepen][pos++]=U[stepen-1][pos2++];
    }
    for(int i=1; i<=N; i+=stepen2*2){
      pos  =i;
      pos1 =i;
      pos11=i+stepen2-1;
      pos2 =i+stepen2;
      pos22=i+stepen2*2-1;
      while(pos1<=pos11 and pos2<=pos22){
        D[stepen][pos++]=max(D[stepen-1][pos2],D[stepen-1][pos1]);
        if(D[stepen-1][pos2]>D[stepen-1][pos1])pos2++;
        else pos1++;
      }
      while(pos1<=pos11)D[stepen][pos++]=D[stepen-1][pos1++];
      while(pos2<=pos22)D[stepen][pos++]=D[stepen-1][pos2++];
    }
  }
  nn=0;
  NN=1;
  while(NN<N){
    NN*=2;
    nn++;
  }
  for(int i=1; i<=M; i++)upit[i].id=i;
  for(int i=1; i<=M; i++){
     upit[i].l=getint();
     upit[i].r=getint();
     upit[i].x=getint();
  }
  for(int i=1; i<=M; i++)upit[i].sol=upit[i].r-upit[i].l+1;
  sort(upit+1,upit+1+M,cmpx1);
  for(int i=1; i<=M; i++)
    upit[i].sol-=seg1(upit[i].l,upit[i].r,1,NN,upit[i].x,nn);
  sort(upit+1,upit+1+M,cmpx2);
  for(int i=1; i<=M; i++)
  upit[i].sol-=seg2(upit[i].l,upit[i].r,1,NN,upit[i].x,nn);
  sort(upit+1,upit+1+M,cmpid);
  for(int i=1; i<=M; i++)printf("%d ",upit[i].sol);
  printf("\n");
  return 0;
}