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

namespace aaa
{ 

    class Program
    {
        public static void Main()
        {
            uint[] x= Console.ReadLine().Split(' ').Select(uint.Parse).ToArray();
            uint n = x[0], m = x[1];

            string[] s1 = new  string[n],s2=new string[m];
            for (uint i = 0; i < n; i++)
                s1[i] = Console.ReadLine();

            for (uint i = 0; i < m; i++)
                s2[i] = Console.ReadLine();

            for (uint i = 0; i < m; i++)
            {
                uint res = 0;
                uint[] rules = s2[i].Split(' ').Select(uint.Parse).ToArray();
                uint end = rules[1];
                uint value = rules[2];
                for (uint j = rules[0]-1; j < end; j++)
                {
                    uint[] arr = s1[j].Split(' ').Select(uint.Parse).ToArray();
                    uint min = arr[0],max=arr[1];
                    if (min<=value && value<=max)
                    {
                        res++;
                    }
                }
                Console.WriteLine(res);
            }


        }
        
    }
}