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

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