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

namespace vage
{
    class Program
    {
        static void Main(string[] args)
        {
            string mn = Console.ReadLine();
            string[] val = mn.Split(' ');
            int N = int.Parse(val[0]);
            int M = int.Parse(val[1]);
            int[] di = new int[N];
            int[] ui = new int[N];
            int[] li = new int[M];
            int[] ri = new int[M];
            int[] xi = new int[M];
            string diui, lrx;
            string[] val2, val3;
            int brojac = 0;
            for (int i = 0; i < N; i++) 
            {
                diui = Console.ReadLine();
                val2 = diui.Split(' ');
                di[i] = int.Parse(val2[0]);
                ui[i] = int.Parse(val2[1]);
            }
            for (int i = 0; i < M; i++)
            {
                lrx = Console.ReadLine();
                val3 = lrx.Split(' ');
                li[i] = int.Parse(val3[0]);
                ri[i] = int.Parse(val3[1]);
                xi[i] = int.Parse(val3[2]);
            }
            for (int i = 0; i < M; i++)
            {
                for (int j = li[i]-1; j <= ri[i]-1; j++)
                {
                    if (di[j] <= xi[i] && xi[i] <= ui[j])
                        brojac++;
                }
                Console.WriteLine(brojac);
                brojac = 0;
            }
        }
    }
}