using System;

namespace ConsoleApp6
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int N = Convert.ToInt32(s[0]);
            int M = Convert.ToInt32(s[1]);
            int[][] granica = new int[N][];
            int[][] pitanja = new int[M][];
            int[] broj_vaga = new int[M];
            for (int i = 0; i < N; i++) {
                granica[i] = new int[3];
                s = Console.ReadLine().Split();
                int d = Convert.ToInt32(s[0]);
                int u = Convert.ToInt32(s[1]);
                granica[i][0] = d;
                granica[i][1] = u;
            } 
            for (int i = 0; i < M; i++) {
                pitanja[i] = new int[3];
                s = Console.ReadLine().Split();
                int l = Convert.ToInt32(s[0]);
                int r = Convert.ToInt32(s[1]);
                int x = Convert.ToInt32(s[2]);
                pitanja[i][0] = l;
                pitanja[i][1] = r;
                pitanja[i][2] = x;
            }
            for (int i = 0; i < M; i++) {
                for (int k = pitanja[i][0]; k <= pitanja[i][1]; k++) {
                    if (pitanja[i][2] >= granica[k - 1][0] && pitanja[i][2] <= granica[k - 1][1]) {
                        broj_vaga[i]++;
                    }
                }
            }
            foreach (int a in broj_vaga) { 
                Console.WriteLine(a);
            }
            Console.ReadLine();
        }
    }
}