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

namespace Vage
{
    class Program
    {
        static void Main(string[] args)
        {
            string [] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            int[,] matrica = new int[n, 2];
            int[] resenje = new int[m];
            int brojac = 0;
            for (int i = 0; i < n; i++)
            {
                s = Console.ReadLine().Split();
                matrica[i, 0] = int.Parse(s[0]);
                matrica[i, 1] = int.Parse(s[1]);
            }
            for(int i = 0; i < m; i++)
            {
                s = Console.ReadLine().Split();
                int id1 = int.Parse(s[0]);
                int id2 = int.Parse(s[1]);
                int tezina = int.Parse(s[2]);
                for(int j = id1-1; j <= id2-1; j++)
                {
                    if (matrica[j, 0] <= tezina && matrica[j,1] >= tezina)
                    {
                        brojac++;
                    }
                }
                resenje[i] = brojac;
                brojac = 0;
            }
            foreach(int e in resenje)
            {
                Console.WriteLine(e);
            }
        }
    }
}