using System;

namespace _4___Vage
{
    class Program
    {
        static void Main()
        {
            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];

            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++)
            {
                int br = 0;

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

                Console.WriteLine(br);
            }
        }
    }
}