using System;

namespace vage
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] s1 = Console.ReadLine().Split(' ');
            int n = int.Parse(s1[0]);
            int m = int.Parse(s1[1]);
            int[,] a = new int[n, 2];
            int[,] b = new int[m, 3];
            for (int i = 0; i < n; i++)
            {
                string[] s = Console.ReadLine().Split(' ');
                a[i, 0] = int.Parse(s[0]);
                a[i, 1] = int.Parse(s[1]);               
            }
            for (int i = 0; i < m; i++)
            {
                string[] s2 = Console.ReadLine().Split(' ');
                b[i, 0] = int.Parse(s2[0]);
                b[i, 1] = int.Parse(s2[1]);
                b[i, 2] = int.Parse(s2[2]);
            }           
            for(int i = 0; i < m; i++)
            {
                int y = b[i, 1]-b[i,0]+1;
                int g = 0;
                int o = b[i, 0];
                for(int j = 0; j < y; j++)
                {
                    
                    if(a[o-1,0]<=b[i,2]&& a[o-1, 1]>= b[i, 2])
                    {
                        g++;
                    }
                    o = o + 1;
                }
                
                Console.WriteLine(g);
            }
            Console.ReadLine();
        }
    }
}