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

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

            string[] nosivost;
            int[] nosivostMin = new int[N], nosivostMax = new int[N];

            for(int i = 0; i < N; i++)
            {
                nosivost = Console.ReadLine().Split(' ');
                nosivostMin[i] = Convert.ToInt32(nosivost[0]);
                nosivostMax[i] = Convert.ToInt32(nosivost[1]);
            }

            string[] unosPitanja;
            int[] l = new int[M], r = new int[M], x = new int[M];
            for(int i = 0; i < M; i++)
            {
                unosPitanja = Console.ReadLine().Split(' ');

                l[i] = Convert.ToInt32(unosPitanja[0]);
                r[i] = Convert.ToInt32(unosPitanja[1]);
                x[i] = Convert.ToInt32(unosPitanja[2]);
            }

            int brojac;
            for(int i = 0; i < M; i++)
            {
                brojac = 0;
                
                for(int j = l[i] - 1; j <= r[i] - 1; j++)
                {
                    if ((x[i] >= nosivostMin[j]) && (x[i] <= nosivostMax[j]))
                    {
                        brojac++;
                    }
                }
                Console.WriteLine(brojac);
            }
        }
    }
}