#include <bits/stdc++.h>

#define f first
#define s second
using namespace std;



int main()
{
   int n,m;
   cin>>n >> m;
   vector<pair<int,int>> a;
   int x,y;

   for(int i=1; i < n+1; i++){
     cin>>x>>y;
        a.push_back(make_pair(x,y));
   }
    while(m--){
        int l,r,x;
        cin>>l>>r>>x;
        l--;
        r--;
        int rez=0;
        do{
            if(a[l].f<=x && a[l].s>=x)rez++;
            l++;
            }while(l<=r);
        cout<<rez<<"\n";
    }


}