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

namespace Takmicenje
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int N, M, d, v, l, r, x, brojac = 0, brojac2 = 0;
            var citac = Console.ReadLine().Split();
            N = int.Parse(citac[0]);
            M = int.Parse(citac[1]);
            var vage = new int[N, 2];
            var mogucnosti = new int[M];
            for (int i = 0; i < N; i++)
            {
                citac = Console.ReadLine().Split();
                d = int.Parse(citac[0]);
                v = int.Parse(citac[1]);
                vage[i, 0] = d;
                vage[i, 1] = v;
            }
            for (int i = 0; i < M; i++)
            {
                citac = Console.ReadLine().Split();
                l = int.Parse(citac[0]);
                r = int.Parse(citac[1]);
                x = int.Parse(citac[2]);
                brojac = 0;
                for (int j = l - 1; j < r; j++)
                {
                    if (vage[j, 0] <= x && vage[j, 1] >= x)
                    {
                        brojac++;
                    }
                }
                mogucnosti[brojac2++] = brojac;
            }
            for (int i = 0; i < M; i++)
            {
                Console.WriteLine(mogucnosti[i]);
            }
        }
    }
}