using System;

namespace ConsoleApp5
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] red = Console.ReadLine().Split(' ');
            int n = int.Parse(red[0]);
            int m = int.Parse(red[1]);
            int[,] a = new int[n, 2];
            int[,] b = new int[m, 3];
            for (int i = 0; i < n; i++)
            {
                red = Console.ReadLine().Split(' ');
                for (int j = 0; j < 2; j++)
                {
                    a[i, j] = int.Parse(red[j]);
                }
            }
            for (int i = 0; i < m; i++)
            {
                red = Console.ReadLine().Split(' ');
                for (int j = 0; j < 3; j++)
                {
                    b[i, j] = int.Parse(red[j]);
                }
            }
            for (int i = 0; i < m; i++)
            {
                int p = b[i, 0] - 1;
                int k = b[i, 1] - 1;
                int t = b[i, 2];
                int br = 0;
                for (int j = p; j <= k; j++)
                {
                    if ((a[j, 0] <= t) && (a[j, 1] >= t))
                    {
                        br++;
                    }
                }
                Console.WriteLine(br);
            }
        }
    }
}