#include<iostream>
 
using namespace std;
 
int main(){
long long s, p;
long long  x, t ,b;
long long c ,d;
cin >> s >> p;
int m [s] [2];
 
for (long long  v = 0; v < s; v++)
{cin >> m[v][0] >> m[v][1];}
 
long long  l[p];
for(long long pp = 0; pp < p; pp++){
long long  k = 0;
cin >> x >> t >> b;
for(long long v = x - 1; v < t; v++){
c = m[v][0];
d =m[v][1];
 
if(c <= b && d >= b)
{k++;}
}
if(s > 0)
{l [pp] = k;}
else
{l [pp] = 0;}
}
for(long long v = 0; v < p; v++)
{cout << l [v] << endl;}
}