#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define N 10000005
using namespace std;
int r[100000];
int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,m;
    cin>>n>>m;

    int a[100000];
    int b[100000];
    int l[100000];
    int d[100000];
    int x[100000];
    for(int i=1;i<=n;i++){
    	cin>>a[i]>>b[i];

	}
    for(int i=0;i<m;i++){
    	cin>>l[i]>>d[i]>>x[i];

	}
clock_t start, end;

    // Start clock
    start = clock();
	for(int i=0;i<m;i++){
		for(int j=l[i];j<=d[i];j++){
            //cout<<x[i]<<" "<<a[j]<<" "<<b[j]<<endl;
			if(x[i]>=a[j] and x[i]<=b[j]){
                r[i]++;

			}
		}
	}
	for(int i=0;i<m;i++){
    	cout<<r[i]<<endl;
	}
	end = clock();

    // Calculate the time difference
    double time_taken
        = double(end - start)
        / double(CLOCKS_PER_SEC);

    // Print the Calculated execution time
    cout << "Execution time: " << time_taken
        << " secs.";
    return 0;
}