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

namespace _27_9
{
    class Program
    {

        static void Main(string[] args)
        {
            int n,m,br=0;
            string[] s1;
            s1 = Console.ReadLine().Split(' ');
            n = int.Parse(s1[0]);
            m = int.Parse(s1[1]);
            int[,]a=new int[n,2];
            int[,]b=new int[m,3];
            for(int i = 0; i <n; i++)
            {
                s1 = Console.ReadLine().Split(' ');
                a[i,0] = int.Parse(s1[0]);
                a[i,1] = int.Parse(s1[1]);
            }
            for (int i = 0; i < m; i++)
            {
                s1 = Console.ReadLine().Split(' ');
                b[i, 0] = int.Parse(s1[0]);
                b[i, 1] = int.Parse(s1[1]);
                b[i, 2] = int.Parse(s1[2]);
            }
            for(int i = 0; i < m; i++)
            {
                br = 0;
                for(int j = b[i, 0]-1; j <= b[i,1]-1;j++)
                {
                    if (a[j, 0] <= b[i, 2] && a[j, 1] >= b[i,2])
                        br++;
                }
                Console.WriteLine("{0}", br);
            }
            Console.ReadLine();
        }
    }
}