#include <iostream>
using namespace std;

class Scales
{
	private:
		int N, M;
	
	public:
		Scales() {}
		
		Scales(int N, int M)
		{
			this->N = N;
			this->M = M;
		}
		
		inline void QNA()
		{
			int d[N], u[N];
			int l[M], r[M], x[M];
			
			for (int i = 0; i < N; i++)
			{
				cin >> d[i];
				cin >> u[i];
			}
			
			for (int i = 0; i < M; i++)
			{
				cin >> l[i];
				cin >> r[i];
				cin >> x[i];
			}
			
			for (int i = 0; i < M; i++)
			{
				int count = 0;
				
				for (int j = l[i] - 1; j <= r[i] - 1; j++)
				{
					if (x[i] >= d[j] && x[i] <= u[j]) count++;
				}
				
				cout << endl << count;
			}
		}
};

int main()
{
	int N, M;
	
	cin >> N;
	cin >> M;
	
	Scales S(N, M);
	S.QNA();
	
	return 1;
}