using System;
using System.Collections.Generic;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] unos1 = Console.ReadLine().Split();
            int n = Convert.ToInt32(unos1[0]);
            int m = Convert.ToInt32(unos1[1]);
            Tuple<int, int>[] vage = new Tuple<int, int>[n];
            for (int i = 0; i < n; i++)
            {
                string[] unos2 = Console.ReadLine().Split();
                vage[i] = Tuple.Create(Convert.ToInt32(unos2[0]), Convert.ToInt32(unos2[1]));
            }
            int[] rezultat = new int[m];
            for(int i = 0; i < m; i++)
            {
                string[] unos3 = Console.ReadLine().Split();
                int odKog = Convert.ToInt32(unos3[0]) - 1;
                int doKog = Convert.ToInt32(unos3[1]) - 1;
                int tezina = Convert.ToInt32(unos3[2]);
                for(int j = odKog; j <= doKog; j++)
                {
                    if (tezina >= vage[j].Item1 && tezina <= vage[j].Item2) rezultat[i]++;
                }
            }
            foreach (int x in rezultat) Console.WriteLine(x);
        }
    }
}