using System;
using System.ComponentModel;
using System.Reflection.Metadata;

namespace zadatak2takmicennje
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string[] values = s.Split(' ');
            int br_vaga = int.Parse(values[0]);
            int br_pitanja = int.Parse(values[1]);
            int[] vaga_start_range = new int[br_vaga];
            int[] vaga_end_range = new int[br_vaga];

            
            for (int i = 0; i < br_vaga; i++)
            {
                string a = Console.ReadLine();
                string[] parametrivaga = a.Split(' ');
                int parametar1 = int.Parse(parametrivaga[0]);
                int parametar2 = int.Parse(parametrivaga[1]);
                vaga_start_range[i] = parametar1;
                vaga_end_range[i] = parametar2;

            }


            int[] vaga_start = new int[br_pitanja]; 
            int[] vaga_end = new int[br_pitanja];
            int[] kilaza = new int[br_pitanja];

            for (int i = 0; i < br_pitanja; i++)
            {
                string b = Console.ReadLine();
                string[] pitanjazavage = b.Split(' ');
                vaga_start[i] = int.Parse(pitanjazavage[0]);
                vaga_end[i] = int.Parse(pitanjazavage[1]);
                kilaza[i] = int.Parse(pitanjazavage[2]);

            }


            for (int i = 0; i < br_pitanja; i++)
            {
                int br_uspesnih_merenja = 0;
                for (int x = vaga_start[i] - 1; x <= vaga_end[i] - 1; x++)
                {
                    if (kilaza[i] >= vaga_start_range[x] && kilaza[i] <= vaga_end_range[x])
                    {
                        br_uspesnih_merenja++;
                    }
                }

                Console.WriteLine(br_uspesnih_merenja);
            }
        }
    }
}