using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp4
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string u = Console.ReadLine();
            string[] ulaz = new string[2];
            ulaz =u.Split(' ');

            int n=int.Parse(ulaz[0]);
            int m = int.Parse(ulaz[1]);

            int[] a = new int[n];
            int[] b = new int[n];

            for (int i = 0; i < n; i++)
            {
                u=Console.ReadLine();
                ulaz = u.Split();

                a[i] =int.Parse(ulaz[0]);
                b[i] =int.Parse(ulaz[1]);
            }

            int[] rez=new int[m];
            ulaz = new string[3];
            int br = 0;

            for (int i = 0; i < m; i++)
            {
                u = Console.ReadLine();
                ulaz = u.Split(' ');
                int l = int.Parse(ulaz[0]);
                int d = int.Parse(ulaz[1]);
                int x = int.Parse(ulaz[2]);

                
                for(int j = l-1; j < d; j++)
                {
                    if ( a[j] <= x && b[j] >= x)
                    {
                        rez[br]++;

                    }
                }
                br++;
            }
            foreach (int i in rez)
            {
                Console.WriteLine(i);
            }
        }
    }
}