#include <iostream>
using namespace std;

int main() 
{
  int n,m,d,u,l,r,x,i,j,br,k;
  i = 0;
  j = 0;
  x = 0;
  k = 0;
  cin>>n>>m;
  int gornja[n];
  int donja[n];
  int ispis[m];
  while (i < n)
    {
      cin>>d>>u;
      donja[i]=d;
      gornja[i]=u;
      i+=1;
    }
  while (j < m)
    {
      br = 0;
      cin>>l>>r>>x;
      while (l<=r)
        {
          if (l<n)
          {
            if (donja[l]<=x && gornja[l]>=x)
              br+=1;
          }
          l+=1;
          ispis[j]=br;
          }
      j+=1;
    }
while (k<m)
  {
    cout<<ispis[k]<<endl;
    k+=1;
  }
  
  return 0;
}