using System;

namespace Takmicenje___Vage
{
    class Program
    {
        public struct Vaga
        {
            public int d;
            public int u;
            public int i;
        }

        public struct Pitanje 
        {
            public int i1;
            public int i2;
            public int x;
            public int br;
        }
        
        static void Main(string[] args)
        {
            string[] str1 = Console.ReadLine().Split();
            int n = int.Parse(str1[0]);
            int m = int.Parse(str1[1]);
            Vaga[] vage = new Vaga[n];
            int indeks = 1;

            for(int i = 0; i < n; i++)
            {
                string[] str2 = Console.ReadLine().Split();
                vage[i].d = int.Parse(str2[0]);
                vage[i].u = int.Parse(str2[1]);
                vage[i].i = indeks;
                indeks++;
            }

            Pitanje[] pitanja = new Pitanje[m];

            for(int i = 0; i < m; i++)
            {
                string[] str3 = Console.ReadLine().Split();
                pitanja[i].i1 = int.Parse(str3[0]);
                pitanja[i].i2 = int.Parse(str3[1]);
                pitanja[i].x = int.Parse(str3[2]);
            }

            int brojac = 0;

            for(int i = 0; i < m; i++)
            {
                for(int j = 0; j < n; j++)
                {
                    if(pitanja[i].i1 <= vage[j].i && pitanja[i].i2 >= vage[j].i && vage[j].d <= pitanja[i].x && pitanja[i].x <= vage[j].u)
                    {
                        brojac++;
                    }
                }

                pitanja[i].br = brojac;
                brojac = 0;
            }

            foreach(Pitanje p in pitanja)
            {
                Console.WriteLine(p.br);
            }
        }
    }
}