using System;
using System.Globalization;
using System.Numerics;

namespace ConsoleApp11
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int n = int.Parse(str[0]);
            int m = int.Parse(str[1]);
            int[,] a = new int[n, 2];
            int[,] b = new int[m, 3];
            for (int i = 0; i < n; i++)
            {
                string[] s = Console.ReadLine().Split(' ');
                for (int j = 0; j < 2; j++)
                {
                    
                    a[i, j] = int.Parse(s[j]);
                }
            }
            for (int i = 0; i < m; i++)
            { 
                string[] s = Console.ReadLine().Split(' ');
                for (int j = 0; j < 3; j++)
                { 
                   
                    b[i, j] = int.Parse(s[j]);
                }
            }
            for (int i = 0; i < m; i++)
            {
                int br = 0;
                int g = b[i, 0]-1;
                int h= b[i, 1]-1;
                for (int j=g;j<=h; j++)
                {  
                    int z = a[j, 0];
                    int x=a[j, 1];
                    if (b[i, 2] >= z && b[i, 2] <= x)
                    {
                        br++;
                    }
                }
                Console.WriteLine(br);
            }
            Console.ReadLine();
        }
    }
}