using System;

namespace ConsoleApp4
{
    class Program
    {
        struct Tezina
        {
            public int d;
            public int u;
        }
        struct Pitanja
        {
            public int l;
            public int r;
            public int x;
        }
        static void Main(string[] args)
        {
            int n, m;
            string[] s = Console.ReadLine().Split();
            n = int.Parse(s[0]);
            m = int.Parse(s[1]);
            Tezina[] tezina = new Tezina[n];
            Pitanja[] pitanja = new Pitanja[m];
            for(int i = 0; i < n; i++)
            {
                s = Console.ReadLine().Split();
                tezina[i].d = int.Parse(s[0]);
                tezina[i].u = int.Parse(s[1]);
            }
            for(int i = 0; i < m; i++)
            {
                s = Console.ReadLine().Split();
                pitanja[i].l = int.Parse(s[0]);
                pitanja[i].r = int.Parse(s[1]);
                pitanja[i].x = int.Parse(s[2]);
            }
            for(int i = 0; i < m; i++)
            {
                int br = 0;
                for(int j = pitanja[i].l; j <= pitanja[i].r; j++)
                {
                    if (tezina[j - 1].d <= pitanja[i].x && tezina[j - 1].u >= pitanja[i].x) br++;
                }
                Console.WriteLine(br);
            }
        }
    }
}