using System;
using System.Collections.Generic;
using System.Linq;


namespace ConsoleApp1
{
    internal class Program
    {
        public struct Vaga
        {
            public int min;
            public int max;
        }
        public static void Main(string[] args)
        {
            string[] red = Console.ReadLine().Split();
            List<Vaga> list = new List<Vaga>();
            int n = Convert.ToInt32(red[0]);
            int m = Convert.ToInt32(red[1]);
            for (int i = 0; i < n; i++)
            {
                red = Console.ReadLine().Split();
                Vaga vaga = new Vaga();
                vaga.min = Convert.ToInt32(red[0]);
                vaga.max = Convert.ToInt32(red[1]);
                list.Add(vaga);
            }
            for (int i = 0; i < m; i++)
            {
                red = Console.ReadLine().Split();
                int a = Convert.ToInt32(red[0]);
                int b = Convert.ToInt32(red[1]);
                int masa = Convert.ToInt32(red[2]);
                int brojac = 0;
                for(int j = a-1; j < b; j++)
                {
                    if(masa <= list[j].max && masa >= list[j].min)
                    {
                        brojac++;
                    }
                }
                Console.WriteLine(brojac);
            }
        }
    }
}