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

namespace Vage
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string unos;
            unos = Console.ReadLine();
            int n, m;
            string[] pom = unos.Split(' ');
            n = Convert.ToInt32(pom[0]);
            m = Convert.ToInt32(pom[1]);
            int[] d = new int[n]; // Donja granica
            int[] u = new int[n]; // Gornja granica

            for (int i = 0; i < n; i++)
            {
                unos = Console.ReadLine();
                pom = unos.Split(' ');
                d[i] = Convert.ToInt32(pom[0]);
                u[i] = Convert.ToInt32(pom[1]);
            }

            int[] l = new int[m]; // Leva granica
            int[] r = new int[m]; // Desna granica
            int[] x = new int[m]; // Tezina merenja

            for (int i = 0; i < m; i++)
            {
                unos = Console.ReadLine();
                pom = unos.Split(' ');
                l[i] = Convert.ToInt32(pom[0]);
                r[i] = Convert.ToInt32(pom[1]);
                x[i] = Convert.ToInt32(pom[2]);
            }

            int brojac = 0;

            for (int i = 0; i < m; i++)
            {
                brojac = 0;
                for (int j = l[i]; j < r[i]; j++)
                {
                    if (x[i] >= d[j] && x[i] <= u[j])
                    {
                        brojac++;
                    }
                }
                Console.WriteLine(brojac);
                
            }


            Console.ReadLine();
        }
    }
}