#include <math.h>
#include <stdio.h>

int main() {
  int N, M;
  scanf("%d%d", &N, &M);
  int nizd[N], nizu[N], nizl[M], nizr[M], nizx[M];
  for (int i = 0; i < N; i++)
    scanf("%d%d", &nizd[i], &nizu[i]);
  for (int i = 0; i < M; i++)
    scanf("%d%d%d", &nizl[i], &nizr[i], &nizx[i]);
  for (int i = 0; i < M; i++) {
    int br = 0;
    for (int j = nizl[i]; j <= nizr[i]; j++) {
      if (nizd[j] <= nizx[i] && nizu[j] >= nizx[i]) {
        br++;
      }
    }
    printf("%d\n", br);
  }

  return 0;
}