#include<stdio.h>
unsigned long long provera(unsigned long long poc, unsigned long long kraj, unsigned long long x1,unsigned long long od[], unsigned long long do1[] );

int main(){
unsigned long long N,M;
scanf("%lld %lld",&N,&M);
unsigned long long d[N],u[N];
unsigned long long l[M],r[M],x[M];

 for(int i=0;i<N;i++){
 	scanf("%lld %lld",&d[i],&u[i]);
}
  for( int i=0;i<M;i++){
 	scanf("%lld %lld %lld",&l[i],&r[i],&x[i]);
}
 for( int i=0;i<M;i++){
printf("%lld\n", provera(l[i],r[i],x[i],d,u));
}
	return 0;
}
unsigned long long provera(unsigned long long poc, unsigned long long kraj, unsigned long long x1,unsigned long long od[], unsigned long long do1[] ){
unsigned long long br=0;
	for(int i=poc-1;i<kraj;i++){
		if(x1==od[i]||x1==do1[i]||x1>od[i]&&x1<do1[i]) br++;
	}
	return br;
}