using System;

namespace ConsoleApp53
{
    class Program
    {
        static void stampaj(int[] d, int[] g, int n, int l, int r, int x)
        {
            int brojac = 0;
            for (int i = l; i <= r; i++) 
            {
                if (x <= g[i] && x >= d[i])
                    brojac++;
            }
            Console.WriteLine(brojac);
        }
        static void Main(string[] args)
        {
            string[] unos = Console.ReadLine().Split();
            int n = int.Parse(unos[0]), m = int.Parse(unos[1]);
            int[] d = new int[n], g = new int[n];
            int[] l = new int[m], r = new int[m], x = new int[m];
            
            for (int i = 0; i<n; i++)
            {
                unos = Console.ReadLine().Split();
                d[i] = int.Parse(unos[0]);
                g[i] = int.Parse(unos[1]);
            }

            for (int i = 0; i < m; i++)
            {
                unos = Console.ReadLine().Split();
                l[i] = int.Parse(unos[0]);
                r[i] = int.Parse(unos[1]);
                x[i] = int.Parse(unos[2]);
            }

            for (int i = 0; i < m; i++)
            {
                stampaj(d, g, n, l[i]-1, r[i]-1, x[i]);
            }


        }
    }
}