using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            int[,] a = new int[200000, 2];
            for (int i = 0; i < n; i++)
            {
                s = Console.ReadLine().Split();
                a[i, 0] = int.Parse(s[0]);
                a[i, 1] = int.Parse(s[1]);
            }
            int[] b = new int[200000];
            for (int i = 0; i < m; i++)
            {
                s = Console.ReadLine().Split();
                int f = int.Parse(s[0]);
                int g = int.Parse(s[1]);
                int h = int.Parse(s[2]);
                int z = 0;
                for (int j = f - 1; j < g; j++)
                {
                    if (h >= a[j, 0] && h <= a[j, 1]) z++;
                }
                b[i] = z;
            }
            for (int i = 0; i < m; i++)
            {
                Console.WriteLine(b[i]);
            }
        }
    }
}