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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            int n = int.Parse(input[0]);
            Tuple<int, int>[] minmax = new Tuple<int, int>[n];
            int m = int.Parse(input[1]);
            int[,] upiti = new int[m, 3];

            List<int> zadovljavajuciKey = new List<int>();


            for (int i = 0; i < n; i++)
            {
                input = Console.ReadLine().Split();
                minmax[i] = new Tuple<int, int>(int.Parse(input[0]), int.Parse(input[1]));

            }

            for (int i = 0; i < m; i++)
            {
                input = Console.ReadLine().Split();

                upiti[i, 0] = int.Parse(input[0]);
                upiti[i, 1] = int.Parse(input[1]);
                upiti[i, 2] = int.Parse(input[2]);
            }

            for (int i = 0; i < m; i++)
            {
                int r = 0;
                for (int j = upiti[i, 0]-1; j <= upiti[i, 1]-1; j++)
                {
                    if (minmax[j].Item1 <= upiti[i, 2] && minmax[j].Item2 >= upiti[i, 2])
                        r++;
                }
                Console.WriteLine(r);
            }
            Console.Read();
        }
    }
}