#include <iostream>

using namespace std;

int main()
{
    unsigned int n,m;
    cin>>n>>m;
    unsigned long d1,u1, l1,r1,x1;
    unsigned long d[n], u[n];
    for(int i=0;i<n;i++)
    {
        cin>>d1>>u1;
        d[i]=d1;
        u[i]=u1;
    }
    unsigned int r[m]={0};
    for(int i=0;i<m;i++)
    {
        cin>>l1>>r1>>x1;
        for(int j=l1;j<=r1;j++)
        {
            if(d[j-1]<=x1 && u[j-1]>=x1)
                {
                    r[i]+=1;
                    //cout<<"vaga br"<<j<<"moze da izmeri vrednost"<<x1<<endl;
                }
        }
    }
    for(int i=0;i<m;i++)
        cout<<r[i]<<endl;
    return 0;
}