#include <iostream>
#include <vector>
#define f(i,n) for(int i=1;i<=n;i++)
using namespace std;

int main()
{
    int n,m; cin>>n>>m;
    vector<pair<int,int> > a(n);
    f(i,n) cin>>a[i].first>>a[i].second;
    f(i,m){
        int l,r,x;
        cin>>l>>r>>x;
        int br=0;
        for(int j=l;j<=r;j++)
        {
            if(x<=a[j].second && x>=a[j].first)
                br++;
        }
        cout<<br<<endl;
    }
    return 0;
}