#include <stdio.h>
#include <stdlib.h>
#define tip unsigned long int

struct vaga{
	tip l, d;
};
struct pitanje{
	tip l, d, x;
};
int main()
{
	tip n, m;
	scanf("%lu%lu", &n, &m);
	struct vaga* v = malloc(sizeof(struct vaga) * n);
	struct pitanje* p = malloc(sizeof(struct pitanje) * m);
	for(tip i = 0; i < n; i++)
		scanf("%lu%lu", &(v[i].l), &(v[i].d));
	for(tip i = 0; i < m; i++)
		scanf("%lu%lu%lu", &(p[i].l), &(p[i].d), &(p[i].x));
	tip br;
	for(tip i = 0; i < m; i++)
	{
		br = 0;
		for(tip k = p[i].l - 1; k <= p[i].d - 1; k++)
		{
			if(p[i].x <= v[k].d && p[i].x >= v[k].l)
				br++;
		}
		printf("%lu\n", br);
	}
	
	return 0;
}