using System;
using System.Collections.Generic;

namespace Vage
{
    internal class Program
    {
        struct Vaga
        {
            public int d, u;
        }

        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            string[] data = input.Split(' ');
            int n = Convert.ToInt32(data[0]);
            int m = Convert.ToInt32(data[1]);
            Vaga[] vage = new Vaga[n];
            Vaga vaga = new Vaga();
            for (int i = 0; i < n; i++)
            {
                input = Console.ReadLine();
                data = input.Split(' ');
                vaga.d = Convert.ToInt32(data[0]);
                vaga.u = Convert.ToInt32(data[1]);
                vage[i] = vaga;
            }
            int[] rezultati = new int[m];
            int l, r, x;
            int br;
            for (int i = 0; i < m; i++)
            {
                input = Console.ReadLine();
                data = input.Split(' ');
                l = Convert.ToInt32(data[0]) - 1;
                r = Convert.ToInt32(data[1]) - 1;
                x = Convert.ToInt32(data[2]);
                br = 0;
                for (int j = l; j <= r; j++) if (x >= vage[j].d && x <= vage[j].u) br++;
                rezultati[i] = br;
            }
            foreach(int rez in rezultati)
            {
                Console.WriteLine(rez);
            }
        }
    }
}