using System;
namespace ConsoleApp5
{
    class Program
    {
        struct Vaga
        {
            public int d;
            public int u;
        }
        struct Pitanje
        {
            public int l;
            public int r;
            public int x;
        }
        static void Main()
        {
            string[] s = Console.ReadLine().Split();
            int N = int.Parse(s[0]),M=int.Parse(s[1]);
            Vaga[] v = new Vaga[N];
            Pitanje[] p = new Pitanje[M];
            for (int i = 0; i < N; i++)
            {
                s = Console.ReadLine().Split();
                v[i].d = int.Parse(s[0]);
                v[i].u = int.Parse(s[1]);
            }
            for (int i = 0; i < M; i++)
            {
                s = Console.ReadLine().Split();
                p[i].l = int.Parse(s[0]);
                p[i].l--;
                p[i].r = int.Parse(s[1]);
                p[i].r--;
                p[i].x = int.Parse(s[2]);
            }
            for (int i = 0; i < M; i++)
            {
                int br = 0;
                for (int j = p[i].l; j <= p[i].r; j++)
                    if (p[i].x >= v[j].d && p[i].x <= v[j].u) br++;
                Console.WriteLine(br);
            }
        }
    }
}