using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;
using System.Threading;
using System.ComponentModel;

namespace Namestanje_Takmicenja
{
    public struct Vaga
    {
        public int x;
        public int y;
    }
    class Program
    {
        public static int MozeLi(int Pocetak, int Kraj, int Kilaza, Vaga[] a)
        {
            int br = 0;
            for(int j = Pocetak; j<= Kraj; j++)
            {
                if (a[j].x <= Kilaza && a[j].y >= Kilaza) br++;
            }
            return br;
        }
        static void Main(string[] args)
        {


            string[] PrvaLinija = Console.ReadLine().Split();
            int N = int.Parse(PrvaLinija[0]);
            int M = int.Parse(PrvaLinija[1]);
            Vaga[] a = new Vaga[N+1];
            int[] resenje = new int[M+1];
            a[0].x = 0;
            a[0].y = 0;
            for(int i = 1; i <= N; i++)
            {
                string[] DrugaLinija = Console.ReadLine().Split();
                a[i].x = int.Parse(DrugaLinija[0]);
                a[i].y = int.Parse(DrugaLinija[1]);
            }           
            for (int i = 1; i <= M; i++)
            {
                string[] TrecaLinija = Console.ReadLine().Split();
                resenje[i] = MozeLi(int.Parse(TrecaLinija[0]), int.Parse(TrecaLinija[1]), int.Parse(TrecaLinija[2]),a);   
            }
            for (int i =1; i <= M; i++)
            {
                Console.WriteLine(resenje[i]);
            }

        }

    }
}