using System;
using System.Text;

namespace Zadaci
{
    class Program
    {
        struct Vaga
        {
            public uint donjaGranica;
            public uint gornjaGranica;
        }
        static uint Pitanja(Vaga[] vage, uint l, uint r, uint x)
        {
            uint resenje = 0;
            for (uint i = l-1; i < r; i++)
            {
                if (x <= vage[i].gornjaGranica && x >= vage[i].donjaGranica)
                {
                    resenje++;
                }
            }
            return resenje;
        }
        static void Main(string[] args)
        {
            string[] temp = Console.ReadLine().Split();
            int n = int.Parse(temp[0]);
            int m = int.Parse(temp[1]);
            Vaga[] vage = new Vaga[n];
            for (int i = 0; i < n; i++)
            {
                temp = Console.ReadLine().Split();
                vage[i].donjaGranica = uint.Parse(temp[0]);
                vage[i].gornjaGranica = uint.Parse(temp[1]);
            }
            uint[] resenja = new uint[m];
            for (int i = 0; i < m; i++)
            {
                temp = Console.ReadLine().Split();
                uint l = uint.Parse(temp[0]);
                uint r = uint.Parse(temp[1]);
                uint x = uint.Parse(temp[2]);
                resenja[i] = Pitanja(vage, l, r, x);
            }
            for (int i = 0; i < m; i++)
            {
                Console.WriteLine(resenja[i]);
            }
        }
    }
}