#include<iostream>

using namespace std;

int main(){
int s, p;
int x, t ,b;
int c ,d;
cin >> s >> p;
int m [s] [2];

for (int v = 0; v < s; v++)
{cin >> m[v][0] >> m[v][1];}

int l[p];
for(int pp = 0; pp < p; pp++)
{
int k = 0;
cin >> x;
cin >> t;
cin >> b;
for(int 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(int v = 0; v < p; v++)
{
cout << l [v] << endl;
}
}