#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
	vector <int> d;
	vector <int> u;
	vector <int> l;
	vector <int> r;
	vector <int> x;
	d.push_back(NULL);
	u.push_back(NULL);
	l.push_back(NULL);
	r.push_back(NULL);
	x.push_back(NULL);
	int n, m, ct = 0, d1, u1, l1, r1, x1;
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
	{
		cin >> d1 >> u1;
		d.push_back(d1);
		u.push_back(u1);
	}
	for (int i = 1; i <= m; i++)
	{
		cin >> l1 >> r1 >> x1;
		l.push_back(l1);
		r.push_back(r1);
		x.push_back(x1);
	}

	for (int i = 1; i <= m; i++)
	{
		ct = 0;
		for(int j = l[i]; j <= r[i]; j++)
		{ 
			if (d[j] <= x[i] && u[j] >= x[i])
				ct++;
		}
		cout << ct << "\n";
	}
}