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

namespace tak._4
{
    class Program
    {
        struct Vaga
        {
            public int d;
            public int u;
        }
        struct Pitanja
        {
            public int l;
            public int r;
            public int x;
        }

        static void Main(string[] args)
        {
            string[] pom = Console.ReadLine().Split();
            int n = int.Parse(pom[0]);
            int m = int.Parse(pom[1]);
            Vaga[] niz1 = new Vaga[n];
            for (int i = 0; i < niz1.Length; i++)
            {
                pom = Console.ReadLine().Split();
                niz1[i].d = int.Parse(pom[0]);
                niz1[i].u = int.Parse(pom[1]);
            }
            Pitanja[] niz2 = new Pitanja[m];
            for (int i = 0; i < niz2.Length; i++)
            {
                pom = Console.ReadLine().Split();
                niz2[i].l = int.Parse(pom[0]);
                niz2[i].r = int.Parse(pom[1]);
                niz2[i].x = int.Parse(pom[2]);
            }
            int br;
            for (int i = 0; i < niz2.Length; i++)
            {
                br = 0;
                for (int j = 0; j < niz1.Length; j++)
                {
                    if (niz2[i].l - 1 <= j && j <= niz2[i].r - 1)
                    {
                        if (niz1[j].d <= niz2[i].x && niz2[i].x <= niz1[j].u)
                            br++;
                    }
                }
                Console.WriteLine(br);
            }
        }
    }
}