using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication34
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            long n = long.Parse(s[0]);
            long m = long.Parse(s[1]);
            long[,] vage=new long[n,2];
            for (long i = 0; i < n; i++)
            {
                string[] st = Console.ReadLine().Split(' ');

                for (int k = 0; k < 2; k++)
                {
                    vage[i, k] = long.Parse(st[k]);
                }
            }
            for (long i = 0; i < m; i++)
            {
                string[] t = Console.ReadLine().Split(' ');
                long l = long.Parse(t[0])-1;
                long r = long.Parse(t[1])-1;
                long x = long.Parse(t[2]);

                long broj=0;

                for (long j = l; j <= r; j++)
                {
                    if (vage[j, 0] <= x && vage[j, 1] >= x) broj++;
                }
               Console.WriteLine(broj);
            }
           // Console.ReadLine();
        }
    }
}