using System;

namespace TAKMICENJE_1_2_VAGE
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] unos = Console.ReadLine().Split();
            long n = long.Parse(unos[0]), m = long.Parse(unos[1]);
            long[,] vage = new long[n, 2];
            long[,] pitanja = new long[m, 3];
            long[] odgovori = new long[m];
            for (int i = 0; i < n; i++)
            {
                unos = Console.ReadLine().Split();
                vage[i, 0] = long.Parse(unos[0]);
                vage[i, 1] = long.Parse(unos[1]);
            }
            for (int i = 0; i < m; i++)
            {
                unos = Console.ReadLine().Split();
                pitanja[i, 0] = long.Parse(unos[0]) - 1;
                pitanja[i, 1] = long.Parse(unos[1]) - 1;
                pitanja[i, 2] = long.Parse(unos[2]);
                odgovori[i] = 0;
            }
            /*
            foreach(var x in pitanja)
                Console.WriteLine(x);*/

            for (int i = 0; i < m; i++)
            {
                for (int j = (int)pitanja[i, 0]; j <= pitanja[i, 1]; j++)
                {
                    //Console.WriteLine("i = " + i);
                    //Console.WriteLine("j = " + j);
                    //Console.WriteLine("vage[j, 0] = {0} pitanja[i, 2] = {1} vage[j, 1] = {2} pitanja[i, 2] = {1}", vage[j, 0], pitanja[i, 2], vage[j, 1]);
                    if (vage[j, 0] <= pitanja[i, 2] && vage[j, 1] >= pitanja[i, 2])
                        odgovori[i]++;
                }
            }
            foreach(var x in odgovori)
                Console.WriteLine(x);
        }
    }
}