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[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            Tuple<int, int>[] t = new Tuple<int, int>[n];
            for (int i = 0; i < n; i++)
            {
                s = Console.ReadLine().Split();
                t[i] = new Tuple<int, int>(int.Parse(s[0]), int.Parse(s[1]));
            }
            for (int i = 0; i < m; i++)
            {
                s = Console.ReadLine().Split();
                int l = int.Parse(s[0]);
                int r = int.Parse(s[1]);
                int w = int.Parse(s[2]);
                int sum = 0;
                for (; l <= r; l++)
                {
                    if (t[l - 1].Item1 <= w && t[l - 1].Item2 >= w)
                        sum++;
                }
                Console.WriteLine(sum);
            }
        }
    }
}