using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Security.Cryptography.X509Certificates;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main()
        {
            var linija = Console.ReadLine().Split();
            int N = int.Parse(linija[0]);
            int M = int.Parse(linija[1]);

            int[,] limit_vaga = new int[N, 2];  
            for (int i=0;i<N;i++)
            {
                linija = Console.ReadLine().Split();
                for (int j=0;j<2;j++)
                {
                    limit_vaga[i,j] = int.Parse(linija[j]);
                }
            }

            int[,] pitanja = new int[M, 3]; 
            for (int i = 0; i < M; i++)
            {
                linija = Console.ReadLine().Split();
                for (int j = 0; j < 3; j++)
                {
                    pitanja[i, j] = int.Parse(linija[j]);
                }
            }
            
            int broj_vagi = 0;
            for (int d=0;d<M;d++)
            {
                for (int i = pitanja[d,0];i <= pitanja[d,1];i++)
                {
                    if (limit_vaga[i-1,0]<=pitanja[d,2] && limit_vaga[i - 1,1] >= pitanja[d,2])
                    {
                        broj_vagi++;
                    }
                        
                }
                Console.WriteLine(broj_vagi);
                broj_vagi = 0;
            }
            


            

        }
        
       
    }
}