using System;

namespace Takmicenje
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(" ");
            int N = int.Parse(s[0]);
            int M = int.Parse(s[1]);

            int[,] vage = new int[N, 2];
            int[,] pitanja = new int[M, 3];
            int[] odgovori = new int[M];

            for (int i = 0; i < M; i++)
                odgovori[i] = 0;

            for (int i = 0; i < N; i++)
            {
                s = Console.ReadLine().Split(" ");
                for (int j = 0; j < 2; j++)
                    vage[i, j] = int.Parse(s[j]);
            }

            for (int i = 0; i < M; i++)
            {
                s = Console.ReadLine().Split(" ");
                for (int j = 0; j < 3; j++)
                    pitanja[i, j] = int.Parse(s[j]);
            }

            for (int i = 0; i < M; i++)
                for (int j = pitanja[i, 0] - 1; j <= pitanja[i, 1] - 1; j++)
                    if (vage[j, 0] <= pitanja[i, 2] && vage[j, 1] >= pitanja[i, 2]) odgovori[i]++;

            foreach (var item in odgovori)
            {
                Console.WriteLine(item);
            }
        }
    }
}