using System;
using System.Collections;
using System.Linq;

public class Program
{
    static public void Main()
    {
        string[] s = Console.ReadLine().Split();
        int n = int.Parse(s[0]);
        int m = int.Parse(s[1]);
        int[] vagamin = new int[n];
        int[] vagamax = new int[n];
        int opsegDonji;
        int opsegGornji;
        int brojKila;
        int mozeli;
        int[] gotovo = new int[m];
        for (int i = 0; i < n; i++)
        {
            string[] a = Console.ReadLine().Split();
            vagamin[i] = int.Parse(a[0]);
            vagamax[i] = int.Parse(a[1]);
        }
        for (int i = 0; i < m; i++)
        {
            string[] b = Console.ReadLine().Split();
            opsegDonji = int.Parse(b[0]) - 1;
            opsegGornji = int.Parse(b[1]) - 1;
            brojKila = int.Parse(b[2]);
            mozeli = 0;
            for (int j = opsegDonji; j <= opsegGornji; j++)
            {
                if (brojKila <= vagamax[j] && brojKila >= vagamin[j]) mozeli += 1;
            }
            gotovo[i] = mozeli;
        }
        foreach (int x in gotovo) { 
            Console.WriteLine(x);
        }
        


    }
    

}