#include <iostream>

using namespace std;

int main()
{
    int i,j;
    unsigned int N,M;
    cin >> N >> M;
    long long int d[N], u[N], l[M], r[M], x[M], R[M];
    for(i=0;i<N;i++) cin >> d[i] >> u[i];
    for(i=0;i<M;i++) cin >> l[i] >> r[i] >> x[i];

    for(i=0;i<M;i++){
        R[i]=0;
        for(j=l[i]-1;j<r[i];j++){
            if(x[i]>=d[j]&&x[i]<=u[j])
                R[i]++;
        }
        cout << R[i] << endl;
    }

    return 0;
}