#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    int q;
    int p,d,u;
    cin>>n>>q;
    int a[n];
    int b[n];
    for (int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
    }
    for (int k=0;k<q;k++)
    {
        cin>>p>>d>>u;
        int rez=0;
        for (int i=p-1;i<d;i++)
        {
            if (a[i]<=u && b[i]>=u)
                rez++;
        }
        cout<<rez<<endl;
    }
}