using System;

namespace ConsoleApp27
{
    class Program
    {
        static void Main(string[] args)
        {
            int N, M;
            string G1, G2, G = Console.ReadLine();
            N = Int32.Parse(G.Split(' ')[0]);
            M = Int32.Parse(G.Split(' ')[1]);
            int[,] a = new int[N, 2];
            int[,] b = new int[M, 3];
            int[] c = new int[M];
            for (int i = 0; i < N; i++)
            {
                G1 = Console.ReadLine();
                a[i, 0] = Int32.Parse(G1.Split(' ')[0]);
                a[i, 1] = Int32.Parse(G1.Split(' ')[1]);
            }
            for (int k = 0; k < M; k++)
            {
                G2 = Console.ReadLine();
                b[k, 0] = Int32.Parse(G2.Split(' ')[0]);
                b[k, 1] = Int32.Parse(G2.Split(' ')[1]);
                b[k, 2] = Int32.Parse(G2.Split(' ')[2]);
                c[k] = 0;
                for (int j = b[k, 0] - 1; j < b[k, 1]; j++)
                {
                    if (a[j, 0] <= b[k, 2] && a[j, 1] >= b[k, 2])
                    {
                        c[k]++;
                    }
                }
            }
            foreach (int i in c)
            {
                Console.WriteLine(i);
            }
        }
    }
}