#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct vaga
{
	unsigned int index;
	unsigned int donja;
	unsigned int gornja;
};

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

struct vaga* findv(struct vaga* vage, unsigned int index, unsigned int n)
{
	for(unsigned int i = 0; i < n; i++)
		if(vage[i].index == index)
			return &vage[i];
	
	return NULL;
}

int main(void)
{
	unsigned int	M = 0,
					N = 0,
					i, j,
					rezultat;
	
	struct vaga* vage = NULL;
	struct vaga* vaga1 = NULL;
	struct pitanje* pitanja = NULL;
	struct pitanje* pitanje1 = NULL;
	
	scanf("%u %u", &N, &M);
	vage = malloc(N * sizeof(struct vaga));
	for(i = 0; i < N; i++)
	{
		vaga1 = &vage[i];
		vaga1->index = i + 1;
		scanf("%u %u", &(vaga1->donja), &(vaga1->gornja));
	}
	
	pitanja = malloc(M * sizeof(struct pitanje));
	for(i = 0; i < M; i++)
	{
		pitanje1 = &pitanja[i];
		scanf("%u %u %u", &(pitanje1->l), &(pitanje1->r), &(pitanje1->x));
	}
	
	for(i = 0; i < M; i++)
	{
		rezultat = 0;
		pitanje1 = &pitanja[i];
		for(j = pitanje1->l; j <= pitanje1->r; j++)
		{
			vaga1 = findv(vage, j, N);
			if(vaga1 != NULL)
				if(vaga1->donja <= pitanje1->x && vaga1->gornja >= pitanje1->x)
					rezultat++;
		}
		printf("%u\n", rezultat);
	}
		
	free(vage);
	free(pitanja);
	
	return 0;
}