#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{
    long long n, m;
    cin>>n>>m;
    long long d[n], u[n], l[m], r[m], x[m];
    for(long long i=0; i<n; i++)
        cin>>d[i]>>u[i];
    for(long long i=0; i<m; i++)
        cin>>l[i]>>r[i]>>x[i];
    for(long long i=0; i<m; i++)
    {
        long long k=0;
        for(long long j=l[i]-1; j<=r[i]-1; j++)
        {
            if(x[i]<=u[j] && d[j]<=x[i])
            {
                k+=1;
            }
        }
        cout<<k<<endl;
    }
}