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

namespace Vage
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] brojevi = Console.ReadLine().Split();
            long M, N;
            M = long.Parse(brojevi[0]);
            N = long.Parse(brojevi[1]);
            long[,] vage = new long[M, 2];
            long[,] ispitivanje = new long[N, 3];
            for (int i = 0; i < M; i++)
            {
                string[] unos = Console.ReadLine().Split();
                for (int j = 0; j < 2; j++)
                {
                    vage[i, j] = long.Parse(unos[j]);
                }
            }
            for (int i = 0; i < N; i++)
            {
                string[] unos = Console.ReadLine().Split();
                for (int j = 0; j < 3; j++)
                {
                    ispitivanje[i, j] = long.Parse(unos[j]);
                }
            }
            int[] brojPitanja = new int[N];
            for (int i = 0; i < ispitivanje.GetLength(0); i++)
            {
                for (long j = ispitivanje[i, 0] - 1; j <= ispitivanje[i, 1] - 1; j++)
                {
                    if (ispitivanje[i, 2] >= vage[j, 0] && ispitivanje[i, 2] <= vage[j, 1]) brojPitanja[i]++;
                }
            }
            for (int i = 0; i < brojPitanja.Length; i++)
            {
                Console.WriteLine(brojPitanja[i]);
            }
        }
    }
}