#include <iostream>
#include <algorithm>
using namespace std;

int main(){

  int brv, brp,f=0,mx[brv],mn[brv],drindrin;
  cin>>brv>>brp;;
  for(drindrin=0; drindrin<brv; drindrin++){
      cin >>mn[drindrin]>>mx[drindrin];
      }
 int v1[brp], v2[brp], v3[brp];
  for(drindrin=0; drindrin<brp ; drindrin++){
      cin >>v1[drindrin]>>v2[drindrin]>>v3[drindrin];
      }
   for(drindrin=0; drindrin<brp ; drindrin++){
     f=0;
     for (int bascanska_ploca=v1[drindrin]; bascanska_ploca<=v2[drindrin]; bascanska_ploca++){
            if (v3[drindrin]<=mx[bascanska_ploca-1] && v3[drindrin]>=mn[bascanska_ploca-1])    {
             f++;
         }else{};
     }
     cout<<f<<endl;
   }

    return 0;
}