using System;

  internal class Program
  {
     static void Main(string[] args)
     {
        string[] s = Console.ReadLine().Split(' ');
        int N = int.Parse(s[0]);
        int M = int.Parse(s[1]);

        int[] d = new int[N]; 
        int[] u = new int[N]; 
        for (int i = 0; i < N; i++)
        {
            string[] unos = Console.ReadLine().Split(' ');
            d[i] = int.Parse(unos[0]);
            u[i] = int.Parse(unos[1]);

        }

        int[,] pitanje = new int[M, 3];
        for (int i = 0; i < M; i++)
        {
            string[] unosp = Console.ReadLine().Split(' ');
            for (int j = 0; j < 3; j++)
            {
                pitanje[i, j] = int.Parse(unosp[j]);
            }
        }

        int[] odgovori = new int[M];
        for (int i = 0; i < M; i++)
        {
            int sumvaga = 0;
            for (int j = (pitanje[i,0]-1); j <= (pitanje[i, 1]-1); j++)
            {
                if (d[j] <= pitanje[i,2]&& pitanje[i, 2] <= u[j])
                {
                    sumvaga++;
                }

            }
            odgovori[i] = sumvaga;
        }

        foreach(int el in odgovori)
        {
            Console.WriteLine(el);
        }
    }
  }