#include <stdio.h>
#include <stdlib.h>
typedef struct {
  int d, u;
} Vaga;
typedef struct {
  int l, r, x;
} Pitanje;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  Vaga *vage = (Vaga *)malloc(n * sizeof(Vaga));
  Pitanje *pitanja = (Pitanje *)malloc(m * sizeof(Pitanje));
  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 odgovor = 0;
    int min = pitanja[i].l - 1;
    int max = pitanja[i].r - 1;
    for (int j = min; j <= max; j++)
      if (pitanja[i].x >= vage[j].d && pitanja[i].x <= vage[j].u)
        odgovor++;
    printf("%d\n", odgovor);
  }
}