using System;
using System.Collections.Generic;

namespace Takmicenje___2022_11_19
{
    internal class Program
    {
        static void treci()
        {
            string[] temp = Console.ReadLine().Split();
            int n = int.Parse(temp[0]);
            int m = int.Parse(temp[1]);
            List<int> vageDonje = new List<int>();
            List<int> vageGornje = new List<int>();
            for (int i = 0; i < n; i++)
            {
                temp = Console.ReadLine().Split();
                vageDonje.Add(int.Parse(temp[0]));
                vageGornje.Add(int.Parse(temp[1]));
            }
            List<int> resenja = new List<int>();
            for (int i = 0; i < m; i++)
            {
                temp = Console.ReadLine().Split();
                int l = int.Parse(temp[0]) - 1;
                int r = int.Parse(temp[1]) - 1;
                int x = int.Parse(temp[2]);
                int brojac = 0;
                for (int j = l; j <= r; j++)
                {
                    if (vageDonje[j] <= x && vageGornje[j] >= x) brojac++;
                }
                resenja.Add(brojac);
            }
            foreach (var item in resenja)
            {
                Console.WriteLine(item);
            }
        }
        static void Main(string[] args)
        {
            treci();
        }
    }
}