using System;

class Program {
  struct vaga {
    public int d;
    public int u;
  }
  public static void Main (string[] args) {
    string[] s = Console.ReadLine().Split();
    int n = int.Parse(s[0]);
    int m = int.Parse(s[1]);
    vaga[] vage = new vaga[n];
    for (int i = 0; i < n; i++) {
      s = Console.ReadLine().Split();
      vage[i].d = int.Parse(s[0]);
      vage[i].u = int.Parse(s[1]);
    }
    for (int i = 0; i < m; i++) {
      s = Console.ReadLine().Split();
      int l = int.Parse(s[0]);
      int r = int.Parse(s[1]);
      int x = int.Parse(s[2]);
      int br_ispravnih = 0;
      for (int j = l-1; j < r; j++) {
        if (x >= vage[j].d && x <= vage[j].u) {
          br_ispravnih++;
        }
      }
      Console.WriteLine(br_ispravnih);
    }
  }
}