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

namespace takmicenje
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] unos = Console.ReadLine().Split();
            int[,] vage = new int[2, Convert.ToInt32(unos[0])];
            int[] br_vaga = new int[Convert.ToInt32(unos[1])];
            for(int i = 0;i < vage.GetLength(1);i++)
            {
                unos = Console.ReadLine().Split();
                vage[0, i] = Convert.ToInt32(unos[0]);
                vage[1, i] = Convert.ToInt32(unos[1]);
            }

            for(int i = 0;i < br_vaga.Length;i++)
            {
                int br = 0;
                unos = Console.ReadLine().Split();
                int l = Convert.ToInt32(unos[0]) - 1;
                int r = Convert.ToInt32(unos[1]) - 1;
                int x = Convert.ToInt32(unos[2]);
                for(int j = l;j <= r;j++)
                {
                    if(x >= vage[0,j] && x<= vage[1,j])
                    {
                        br++;
                    }
                }
                br_vaga[i] = br;
                
            }
            for(int i = 0;i < br_vaga.Length;i++)
            {
                Console.WriteLine(br_vaga[i]);
            }
            Console.Read();
        }
    }
}