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

namespace ConsoleApp13
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] pred = Console.ReadLine().Split(' ');
            int n = int.Parse(pred[0]);
            int m = int.Parse(pred[1]);
            int[,] a = new int[n, 2];
            for(int i = 0;i<n;i++)
            {
                string[] red = Console.ReadLine().Split(' ');
                a[i, 0] = int.Parse(red[0]);
                a[i, 1] = int.Parse(red[1]);
            }
            string rez = "";
            for(int i = 0;i<m;i++)
            {
                string[] red = Console.ReadLine().Split(' ');
                int l = int.Parse(red[0]) - 1;
                int r = int.Parse(red[1]) - 1;
                int x = int.Parse(red[2]);
                int br = 0;
                for(int j = l;j<=r;j++)
                {
                    if (x >= a[j, 0] && x <= a[j, 1]) br++;
                }
                rez += br.ToString() + Environment.NewLine;
            }
            Console.WriteLine(rez);
            Console.ReadLine();
        }
    }
}