using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
    class Program
    {
        static int proverava(int[]d, int[]u, int l,int r,int x)
        {
            int br = 0;
            for(int i = l; i <= r-1; i++)
            {
                if (x >= d[i] && x <= u[i])
                {
                    br++;
                }
            }
            return br;
        }
        static void vage(int[] l, int[] r, int[]x,int m,int[]d,int []u)
        {
            for(int i=0;i<m;i++)
            {
                Console.WriteLine(proverava(d, u, l[i], r[i], x[i]));
            }
        }
        static void Main(string[] args)
        {
            string []red1 = Console.ReadLine().Split(" ");
            int n=int.Parse(red1[0]);
            int m=int.Parse(red1[1]);
            int[] d = new int[n];
            int[] u = new int[n];
            int[] l = new int[m];
            int[] r = new int[m];
            int[] x = new int[m];
            for(int i=0;i<n;i++)
            {
                string[] red2 = Console.ReadLine().Split(" ");
                d[i]=int.Parse(red2[0]);
                u[i]=int.Parse(red2[1]);
            }
            for (int i = 0; i < m; i++)
            {
                string[] red3 = Console.ReadLine().Split(" ");
                l[i] = int.Parse(red3[0]);
                r[i] = int.Parse(red3[1]);
                x[i] = int.Parse(red3[2]);

            }
            vage(l, r, x, m, d, u);
            Console.ReadLine();
           
        }
    }
}