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

namespace Vage
{
    class Program
    {
        static int odgovor(int[,]pitanja,int br, int[,]vage)
        {
            int tacno = 0;
            for(int i=pitanja[br,0]-1;i<=pitanja[br,1]-1;i++)
            {
                if (vage[i, 0] <= pitanja[br, 2] && pitanja[br, 2] <= vage[i, 1])
                {
                    tacno++;
                }
            }
            return tacno;
        }
        static void Main(string[] args)
        {
            string[] unos = Console.ReadLine().Split();
            int n = int.Parse(unos[0]);
            int m = int.Parse(unos[1]);
            int[,] vage = new int[n, 2];
            for (int i = 0; i < n; i++)
            {
                unos = Console.ReadLine().Split();
                vage[i, 0] = int.Parse(unos[0]);
                vage[i, 1] = int.Parse(unos[1]);
            }
            int[,] pitanja = new int[m, 3];
            for (int i = 0; i < m; i++)
            {
                unos = Console.ReadLine().Split();
                pitanja[i, 0] = int.Parse(unos[0]);
                pitanja[i, 1] = int.Parse(unos[1]);
                pitanja[i, 2] = int.Parse(unos[2]);
            }
            for(int i=0;i<m;i++)
            {
                Console.WriteLine(odgovor(pitanja,i,vage));
            }
        }
    }
}