using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace dobarbrojekat4
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] brojevi = Console.ReadLine().Split(' ');
            int N = Convert.ToInt32(brojevi[0]);
            int M = Convert.ToInt32(brojevi[1]);
            

            List<int> dmm = new List<int>();
            List<int> umm = new List<int>();
            List<int> lmm = new List<int>();
            List<int> rmm = new List<int>();
            List<int> xmm = new List<int>();
            int k = N;
            while (k > 0)
            {
                k--;
                string[] dva = Console.ReadLine().Split(' ');
                int d = Convert.ToInt32(dva[0]);
                int u = Convert.ToInt32(dva[1]);
                
                dmm.Add(d);
                umm.Add(u);
                


            }
            k = M;
            while (k > 0)
            {
                k--;
                string[] dva = Console.ReadLine().Split(' ');
                int l = Convert.ToInt32(dva[0]);
                int r = Convert.ToInt32(dva[1]);
                int x = Convert.ToInt32(dva[2]);

                lmm.Add(l);
                rmm.Add(r);
                xmm.Add(x);



            }
            k = 0;
            int s = 0;
            int t = 0;
            while (k < M)
            {
                s = 0;
                t = 0;
                while (s < N)
                {
                    if ((s+1) >= lmm[k] && (s+1) <= rmm[k])
                    {
                        if (xmm[k]>=dmm[s]  && xmm[k] <= umm[s])
                        {
                            t++;
                        }
                        else
                        {

                        }
                    }
                    else
                    {

                    }
                    
                    s++;
                }
                Console.WriteLine(t);
                
                k++;
            }





            
        }
    }
}