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

namespace midgeti
{
    internal class Program
    {
        struct Kid
        {
            public int d;
            public int u;
        }
        static void Main(string[] args)
        {
            string[] tokens = Console.ReadLine().Split();
            int n = int.Parse(tokens[0]);
            int m = int.Parse(tokens[1]);
            Kid[] ar = new Kid[n];
            int[] res = new int[m];
            int resi = 0;
            for(int i = 0; i < n; i++)
            {
                tokens = Console.ReadLine().Split();
                ar[i].d = int.Parse(tokens[0]);
                ar[i].u = int.Parse(tokens[1]);
            }
            for(int i = 0; i < m; i++)
            {
                tokens = Console.ReadLine().Split();
                int l = int.Parse(tokens[0]);
                int r = int.Parse(tokens[1]);
                int x = int.Parse(tokens[2]);
                for (int j = l - 1; j < r; j++)
                {
                    if (x >= ar[j].d && x <= ar[j].u) res[resi]++;
                }
                resi++;
            }
            for(int i = 0; i < m; i++)
            {
                Console.WriteLine(res[i]);
            }
        }
    }
}