using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace ConsoleApp4
{
    internal class Program
    {
 
        private static void Main(string[] args)
        {
            int i,br=0;
            string s = Console.ReadLine();
            string[] s1 = s.Split(' ');
            int n = int.Parse(s1[0]);
            int m = int.Parse(s1[1]);
            int[] d = new int[n];
            int[] g = new int[n];
            int[] l = new int[m];
            int[] r = new int[m];
            int[] x = new int[m];
            for (i=0;i<n;i++)
            {
                s = Console.ReadLine();
                s1 = s.Split(' ');
                d[i] = int.Parse(s1[0]);
                g[i] = int.Parse(s1[1]);
            }
            for (i = 0; i < m; i++)
            {
                s = Console.ReadLine();
                s1 = s.Split(' ');
                l[i] = int.Parse(s1[0]);
                r[i] = int.Parse(s1[1]);
                x[i] = int.Parse(s1[2]);
            }
            for(i = 0; i < m; i++)
            {
                for(int j = l[i] - 1; j < r[i]; j++)
                {
                    if (x[i] >= d[j] && x[i] <= g[j])
                        br++;
                }
                Console.WriteLine(br);
                br = 0;
            }


        }
    }
}