#include <iostream>
#include <math.h>

using namespace std;

# define MAXMN 20000

int main()
{
   int n,m,d[MAXMN],u[MAXMN],l,r,x;

   cin >> n >> m;

   for(int i=1;i<=n; i++)
    cin >> d[i] >> u[i];
   int brojac=0;
   while(m--)
   {
       cin >> l >> r >> x;
       for(int i=l;i<=r;i++)
        if(d[i]<=x && x<=u[i])
            brojac++;

      cout<< brojac<< endl;
    brojac=0;
   }

    return 0;
}