using System;

namespace Vage
{
    internal class Program
    {
        static void Main(string[] args)
        {
            long[] row1 = getUnos();

            long n = row1[0];
            long m = row1[1];

            long[,] vage = new long[n, 2];

            for(long i = 0; i < n; i++) {
                long[] input = getUnos();
                vage[i, 0] = input[0];
                vage[i, 1] = input[1];
            }
            

            for(long i = 0; i < m; i++) {
                long[] input = getUnos();

                long l = input[0] - 1;
                long r = input[1] - 1;
                long x = input[2];

                long count = 0;
                for(long j = l; j <= r; j++) {
                    if(x >= vage[j, 0] && x <= vage[j, 1]) {
                        count++;
                    }
                }
                System.Console.WriteLine(count);
            }
        }

        static long[] getUnos() {
            return Console
                .ReadLine()
                .Split(new Char[] {' '}, StringSplitOptions.RemoveEmptyEntries)
                .Select(item => long.Parse(item))
                .ToArray();
        }
    }
}