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

namespace takmicenjeprvi
{
    internal class Program
    {
        static int[,] UnosMatrica(int broj1, int broj2)
        {
            int[,] matrica = new int[broj1, broj2];
            for (int i = 0; i < broj1; i++)
            {
                string red = Console.ReadLine();
                string[] pomocni = red.Split();
                for (int j = 0; j < broj2; j++)
                {
                    matrica[i, j] = int.Parse(pomocni[j]);
                }
            }
            return matrica;
        }
        static void Main(string[] args)
        {
            string unos = Console.ReadLine();
            string[] NM = unos.Split();
            int[,] tezine = UnosMatrica(int.Parse(NM[0]), 2);
            int[,] pitanja = UnosMatrica(int.Parse(NM[1]), 3);
            int brojac = 0;
            for (int i = 0; i < pitanja.GetLength(0); i++)
            {
                for (int j = pitanja[i, 0]; j <= pitanja[i, 1]; j++)
                {
                    if (tezine[j - 1, 0] <= pitanja[i, 2] && tezine[j - 1, 1] >= pitanja[i, 2]) brojac++;
                }
                Console.WriteLine(brojac);
                brojac = 0;
            }
        }
    }
}