using System;

class Program
{
    struct Vage
    {
        public int donjaGranica;
        public int gornjaGranica;
    }
    static void Main()
    {
        string[] brojevi = Console.ReadLine().Split();
        int N = int.Parse(brojevi[0]);
        int M = int.Parse(brojevi[1]);

        Vage[] vage = new Vage[N];

        for(int i = 0; i < N; i++)
        {
            string[] granice = Console.ReadLine().Split();
            vage[i].donjaGranica = int.Parse(granice[0]);
            vage[i].gornjaGranica = int.Parse(granice[1]);
        }

        for (int i = 0; i < M; i++)
        {
            string[] Pitanja = Console.ReadLine().Split();
            int br = 0;
            for (int j = int.Parse(Pitanja[0]); j <= int.Parse(Pitanja[1]); j++)
            {
                if (vage[j-1].donjaGranica <= int.Parse(Pitanja[2]) && vage[j-1].gornjaGranica >= int.Parse(Pitanja[2]))
                {
                    br++;
                }
            }
            Console.WriteLine(br);
        }
    }
}