using System;
using System.Collections.Generic;

namespace takmicenje3
{
    internal class Vage
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int N = int.Parse(s[0]);
            int M = int.Parse(s[1]);
            int ind1 = 0;
            int ind2 = 0;
            int min = 0;
            int max = 0;
            int weight = 0;
            int answer = 0;
            List<int> odgovor= new List<int>();

            int[,] vage = new int[9999, 9999];
            for (int i = 0; i < N; i++)
            {
                string[] read = Console.ReadLine().Split(' ');
                min = int.Parse(read[0]);
                max = int.Parse(read[1]);
               
                vage[i, 1] = min;
                vage[i, 2] = max;

               
            }
            int a = 0;
            int b = 0;
            for (int i = 0; i < M; i++)
            {
                string[] read = Console.ReadLine().Split(' ');
                ind1 = int.Parse(read[0]);
                ind2 = int.Parse(read[1]);
                weight = int.Parse(read[2]);
                for (int j = ind1; j < ind2; j++)
                {
                     a = vage[j, 1];
                     b = vage[j, 2];

                    if (weight >= a && weight <= b)
                    {
                        answer++;
                        Console.WriteLine(answer);
                    }
                    else
                    {
                       
                        answer = 0;
                        Console.WriteLine(answer);

                    }
                }
                
            }
            

        }
    }

}