using System;
using System.Collections.Generic;
namespace Vage
{
    class Program
    {

        struct Vaga
        {
            public int d1, g1;//max i min
        }
        struct Pitanja
        {
            public int l, r, x;//opis pitanja
        }
        static int[] Odgovori(Vaga[] v, Pitanja[] p)
        {
            int[] a = new int[p.Length];

            for (int i = 0; i < p.Length; i++)
            {
                for (int k = p[i].l - 1; k <= p[i].r - 1; k++)
                {
                    if (v[k].d1 <= p[i].x & v[k].g1 >= p[i].x)
                    {
                        a[i]++;
                    }

                }
            }
            return a;
        }


        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]);//br vagi
            int m = int.Parse(s[1]);//br pitanja
            Vaga[] v = new Vaga[n];
            Pitanja[] p = new Pitanja[m];

            for (int i = 0; i < n; i++)//Vage - tezine
            {
                string[] s1 = Console.ReadLine().Split();
                v[i].d1 = int.Parse(s1[0]);
                v[i].g1 = int.Parse(s1[1]);
            }

            for (int i = 0; i < m; i++)//Opis pitanja
            {
                string[] s1 = Console.ReadLine().Split();
                p[i].l = int.Parse(s1[0]);
                p[i].r = int.Parse(s1[1]);
                p[i].x = int.Parse(s1[2]);
            }
            int[] a;
            a = Odgovori(v, p);
            foreach (var x in a)
            {
                Console.WriteLine(x);
            }



        }
    }
}