using System;

namespace zad4_takm
{
    class Program
    {
        struct vaga
        {
           public long od;
            public long doo;
        }
        static void Main(string[] args)
        {
            string[] unos = Console.ReadLine().Split();
            int n = int.Parse(unos[0]);
            int m = int.Parse(unos[1]);
            vaga[] a = new vaga[n];
            for(int i = 0; i < n; i++)
            {
                unos = Console.ReadLine().Split();
                a[i].od = int.Parse(unos[0]);
                a[i].doo = int.Parse(unos[1]);
            }
            int[] r = new int[m];
            for(int i = 0; i < m; i++)
            {
                unos = Console.ReadLine().Split();
                int vod = int.Parse(unos[0]) - 1;
                int vdo = int.Parse(unos[1]) - 1;
                long t = long.Parse(unos[2]);
                for(int j = vod; j <= vdo; j++)
               {
                    if (t <= a[j].doo && t >= a[j].od) r[i]++;
               }
            }
           for (int i = 0; i < m; i++) Console.WriteLine(r[i]);
            Console.ReadKey();
        }
    }
}