using System;
using System.Linq;

namespace ConsoleApp23
{
    internal class Program
    {
        struct Merleg
        {
            public int min;
            public int max;
        }

        static void Main(string[] args)
        {
            string bemenet = Console.ReadLine();
            string[] adatok = bemenet.Split(' ').ToArray();
            int n = Convert.ToInt32(adatok[0]);
            int m = Convert.ToInt32(adatok[1]);

            Merleg[] merleg = new Merleg[n];
            for (int i = 0; i < n; i++)
            {
                bemenet = Console.ReadLine();
                adatok = bemenet.Split(' ').ToArray();
                merleg[i].min = Convert.ToInt32(adatok[0]);
                merleg[i].max = Convert.ToInt32(adatok[1]);
            }

            int[] valaszok = new int[m];
            for (int i = 0; i < m; i++)
            {
                bemenet = Console.ReadLine();
                adatok = bemenet.Split(' ').ToArray();
                int also_i = Convert.ToInt32(adatok[0])-1;
                int felso_i = Convert.ToInt32(adatok[1])-1;
                int ker = Convert.ToInt32(adatok[2]);

                int c = 0;
                for (int j = also_i; j <= felso_i; j++)
                {
                    if (ker >= merleg[j].min && ker <= merleg[j].max)
                    {
                        c++;
                    }
                }
                valaszok[i] = c;
            }


            for (int i = 0; i < valaszok.Length; i++)
            {
                Console.WriteLine(valaszok[i]);
            }
            //Console.ReadKey();
        }
    }
}