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

namespace Vage
{
    internal class Program
    {
        struct vaga
        {
            public int d;
            public int u;
        }
        struct pitanja
        {
            public int l;
            public int r;
            public int x;
        }
        static void unos(ref vaga[] v,ref pitanja[] p)
        {
            for(int i=1;i<v.Length;i++)
            {
                string[] red= Console.ReadLine().Split(' ');
                v[i].d = int.Parse(red[0]);
                v[i].u = int.Parse(red[1]);
            }
            for (int i = 0; i < p.Length; i++)
            {
                string[] red = Console.ReadLine().Split(' ');
                p[i].l = int.Parse(red[0]);
                p[i].r = int.Parse(red[1]);
                p[i].x=int.Parse(red[2]);
            }
        }
        static void odgovori(vaga[] v, pitanja[] p)
        {
            int l = 0;
            for(int i=0;i<p.Length;i++)
            {
                l = 0;
                for(int j = p[i].l; j <= p[i].r&&j<v.Length;j++)
                {
                    
                    if (p[i].x >= v[j].d && p[i].x <= v[j].u)
                    {
                        l++;
                        //Console.WriteLine("ovo ulazi " + v[j].d + " " + v[j].u);
                    }
                }
                Console.WriteLine(l);
            }
        }
        static void Main(string[] args)
        {
            string[] red =Console.ReadLine().Split(' ');
            int n=int.Parse(red[0]);
            int m = int.Parse(red[1]);
            vaga[] v = new vaga[n+1];
            pitanja[] p= new pitanja[m];
            unos(ref v,ref p);
            odgovori(v,p);

        }
    }
}