using System;

namespace ConsoleApp1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] ulazString = Console.ReadLine().Split();
            int n = Convert.ToInt32(ulazString[0]);
            int m = Convert.ToInt32(ulazString[1]);
            int[] d = new int[n];
            int[] u = new int[n];
            for (int i = 0; i < n; i++)
            {
                ulazString = Console.ReadLine().Split();
                d[i] = Convert.ToInt32(ulazString[0]);
                u[i] = Convert.ToInt32(ulazString[1]);
            }
            int[] l = new int[m];
            int[] r = new int[m];
            int[] x = new int[m];
            for (int i = 0; i < m; i++)
            {
                ulazString = Console.ReadLine().Split();
                l[i] = Convert.ToInt32(ulazString[0]);
                r[i] = Convert.ToInt32(ulazString[1]);
                x[i] = Convert.ToInt32(ulazString[2]);
            }

            for (int i = 0; i < m; i++)
            {
                int br = 0;
                for (int j = l[i] - 1; j < r[i]; j++)
                {
                    if (d[j] <= x[i] && u[j] >= x[i]) br++;
                }
                Console.WriteLine(br);
                br = 0;
            }
        }
    }
}