#include <iostream>

using namespace std;

int main()
{
    int N, M, i, j;
    cin>>N>>M;
    
    int d[N], u[N];
    for(i=0; i<N; i++)
    {
        cin>>d[i]>>u[i];
    }
    
    int l[M], r[M], x[M],brojilac[M];
    for(i=0; i<M; i++)
    {
        cin>>l[i]>>r[i]>>x[i];
        brojilac[i]=0;
    }
    
    for(i=0; i<M; i++)
    {
        for(j=l[i]; j<=r[i]; j++)
        {
            if(x[i]>=d[j] && x[i]<=u[j])
            {
                brojilac[i]++;
            }
        }
        cout<<brojilac[i]<<endl;
    }
    
    return 0;
}