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

namespace vaga
{
    internal class Program
    {
        public struct vaga
        {
            public int d;
            public int u;
        }
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]); int m = int.Parse(s[1]);
            vaga[] a = new vaga[n];
            int[]br=new int[m];
            for (int i = 0; i < n; i++) { s = Console.ReadLine().Split(' '); a[i].d = int.Parse(s[0]); a[i].u = int.Parse(s[1]); }
            for (int i = 0; i < m; i++)
            {
                
                s = Console.ReadLine().Split(' ');
                int l = int.Parse(s[0]), r = int.Parse(s[1]), x = int.Parse(s[2]);

                for (int j = l - 1; j <= r - 1; j++)
                {
                    if (a[j].d <= x && x <= a[j].u) br[i]++;
                }
            }
            for (int i = 0; i < m; i++)
            {
                Console.WriteLine(br[i]);
            }

        }
    }
}