#include <stdio.h>
struct vaga{
	int d,u;
};

struct pitanje{
	int l,r,x;
};

int main(){
	int N, M;
	scanf("%d %d", &N, &M);
	struct vaga vage[N];
	struct pitanje pitanja[M];
	
	for(int i=0; i<N; i++){
		scanf("%d %d", &vage[i].d, &vage[i].u);
	}
	
	for(int i=0; i<M; i++){
		scanf("%d %d %d", &pitanja[i].l, &pitanja[i].r, &pitanja[i].x);
	}
	
	
	for(int i=0; i<M; i++){
		int count=0;
		for(int j=pitanja[i].l-1; j<=pitanja[i].r-1; j++){
			if(pitanja[i].x>=vage[j].d && pitanja[i].x<=vage[j].u)
				count++;
			
		}
		printf("%d\n",count);
	}

	return 0;
}