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

namespace Takmicenje_2___3__Vage_
{
    class Vaga
    {
        int donjaGranica;
        int gornjaGranica;
        public int DonjaGranica
        {
            get { return donjaGranica; }
            set { donjaGranica = value; }
        } 
        public int GornjaGranica
        {
            get { return gornjaGranica; }
            set { gornjaGranica = value; }
        }
        public Vaga(int donjaGranica, int gornjaGranica)
        {
            this.donjaGranica = donjaGranica;
            this.gornjaGranica = gornjaGranica;
        }
        public bool Opseg(int vrednost)
        {
            return (vrednost >= donjaGranica && vrednost <= gornjaGranica);
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            string[] ulaz = Console.ReadLine().Split();
            int N = Int32.Parse(ulaz[0]);
            int M = Int32.Parse(ulaz[1]);
            int l;
            int r;
            int x;
            int[] nizVrednosti = new int[M];
            Vaga[] nizVaga = new Vaga[N];
            for (int i = 0; i < N; i++)
            {
                ulaz = Console.ReadLine().Split();
                nizVaga[i] = new Vaga(Int32.Parse(ulaz[0]), Int32.Parse(ulaz[1]));
            }
            for (int i = 0; i < M; i++)
            {
                ulaz = Console.ReadLine().Split();
                l = Int32.Parse(ulaz[0]);
                r = Int32.Parse(ulaz[1]);
                x = Int32.Parse(ulaz[2]);
                for (int j = l - 1; j < r; j++)
                {
                    if (nizVaga[j].Opseg(x)) nizVrednosti[i]++;
                }
            }
            foreach (int el in nizVrednosti)
                Console.WriteLine(el);
        }
    }
}