#include <stdio.h>

typedef struct {
  int d;
  int u;
} Vaga;
typedef struct{
  int l;
  int r;
  int x;
} Pitanje;

int main() {
  int n;
  int m;
  scanf("%d %d", &n, &m);
  Vaga vage[n];
  Pitanje pitanja[m];
  
  for(int i = 0; i < n; i++)
    scanf("%d %d", &vage[i].d, &vage[i].u);
  for(int i = 0; i < m; i++)
    scanf("%d %d %d", &pitanja[i].l, &pitanja[i].r, &pitanja[i].x);
  
  for(int i = 0; i < m; i++){
    int counter = 0;
    for(int j = pitanja[i].l - 1; j < pitanja[i]. r; j++){
      if(pitanja[i].x >= vage[j].d && pitanja[i].x <= vage[j].u) {
        counter++;
      }
    }
    printf("%d\n", counter);
  }
}