#include<bits/stdc++.h>

using namespace std;

void NumberOfSegments(vector<pair<int,int>>segments, int point, int s)
{
   vector<pair<int, int>>seg;

   for(int i = 0; i < s; i++)
   {
      seg.push_back({segments[i].first, 1});
      seg.push_back({segments[i].second+1, -1});
   }

   sort(seg.begin(), seg.end(),greater<pair<int,int>>());

   int ct = 0;
   while(!seg.empty() && seg.back().first <= point)
    {
        ct+= seg.back().second;
        seg.pop_back();
    }
    cout<<ct<<"\n";

}


int main()
{

  ios_base::sync_with_stdio(false);
  cin.tie(0);

  vector<pair<int,int>>seg;
  int n,m;
  cin>>n>>m;
  for(int i=0; i<n; i++)
  {
      int a,b;
      cin>>a>>b;
      seg.push_back({a,b});
  }
  for(int i=0; i<m; i++)
  {
      int x,l,r;
      cin>>l>>r>>x;
      vector<pair<int, int>>seg2=vector<pair<int, int>>(seg.begin()+l-1, seg.begin()+r);
      NumberOfSegments(seg2, x, r-l+1);
  }
}