#include <bits/stdc++.h>
using namespace std;

long long n,m,a[100000005],b[100000005],l,r,x,br;

int main(){
  scanf("%lld%lld",&n,&m);

  for(int i = 1; i <= n; i++){
    scanf("%lld%lld",&(a[i]),&(b[i]));
  }

  for(int i = 1; i <= m; i++){
    br = 0;
    scanf("%lld%lld%lld",&l,&r,&x);
    for(int k = l; k <= r; k++){
      if(x >= a[k] && x <= b[k]){
        br++;
      }
    }
    printf("%lld\n",br);
  }

  return 0;
}