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

namespace ConsoleApp21
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] linija = Console.ReadLine().Split();
            int n = int.Parse(linija[0]);
            int m = int.Parse(linija[1]);
            int[,] vage = new int[2, n];

           
            for (int i = 0; i < n; i++)
            {
                linija = Console.ReadLine().Split();
                vage[0, i] = int.Parse(linija[0]);
                vage[1, i] = int.Parse(linija[1]);
               

            }
            int[] niz = new int[m];
            for (int i = 0; i < m; i++)
            {
                linija =Console.ReadLine().Split();
                int l = int.Parse(linija[0]);
                int r = int.Parse(linija[1]);
                int x = int.Parse(linija[2]);
                int br = 0;
                for (int j = l; j <= r; j++)
                {
                    if (vage[0, j-1] <= x && vage[1, j-1] >= x) br++;
                }
                niz[i] = br;
            }
            for (int i = 0; i < m; i++)
            {
                Console.WriteLine(niz[i]);
            }
        }
    }
}