using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class HelloWorld
{
    static void citaj(long n, long m, long [,] niz)
    {
        long i = 0, j = 0;
        for(i=0; i<n; i++)
        {
            string [] ulaz = Console.ReadLine().Split(' ');
            for(j=0; j<m; j++)
            {
                niz[i, j] = long.Parse(ulaz[j]);
            }
        }
    }
    static void pisi(long n, long m, long [,] niz)
    {
        long i = 0, j = 0;
        for(i=0; i<n; i++)
        {
            for(j=0; j<m; j++)
            {
                Console.Write(niz[i, j]);
                Console.Write(' ');
            }
            Console.WriteLine();
        }
    }
    static void Main()
    {
        string [] ulaz = Console.ReadLine().Split(' ');
        long n = long.Parse(ulaz[0]);
        long m = long.Parse(ulaz[1]);
        
        long [,] vage = new long [n, m];
        citaj(n, 2, vage);
        long i = 0, a = 0, b = 0, x = 0, br = 0, j = 0;
        for(i = 0; i<m; i++)
        {
            ulaz = Console.ReadLine().Split(' ');
            a = long.Parse(ulaz[0]); a--;
            b = long.Parse(ulaz[1]); b--;
            x = long.Parse(ulaz[2]);
            br = 0;
            for(j = a; j<=b; j++)
            {
                if(vage[j, 0] <= x && x <= vage[j, 1])
                {
                    br++;
                }
            }
            Console.WriteLine(br);
        }
    }
}