#include <iostream> 
#include <vector>

using namespace std;

int sadrzi(int l, int r, int x, vector<int>& a, vector<int> b){
  int br = 0;
  for(int i = l; i <= r; i++){
    if(x >= a[i] && x <= b[i]) br++;
  }
  return br;
}

int main() {
  int n, m;
  cin >> n >> m;
  vector <int> a(n), b(n), l(m), r(m), x(m);
  for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
  for(int i = 0; i < m; i++) cin >> l[i] >> r[i] >> x[i];
  for(int i = 0; i < m; i++){
    cout << sadrzi(l[i]-1, r[i]-1, x[i], a, b) << "\n";
  }

  
}