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

namespace Zadatak4
{
    class Program
    {
        static int resiti(int l, int d, int x, int[,] matrica)
        {
            int br = 0;
            for (int i = l; i <= d; i++)
                if (matrica[i, 0] <= x && matrica[i, 1] >= x) br++;
            return br;
        }

        static void Main(string[] args)
        {
            int n, m;

            string[] s = Console.ReadLine().Split();
            n = Convert.ToInt32(s[0]);
            m = Convert.ToInt32(s[1]);
            int[,] matrica = new int[n, 2];
            for (int i = 0; i < n; i++)
            {
                string[] s1 = Console.ReadLine().Split();
                matrica[i, 0] = Convert.ToInt32(s1[0]);
                matrica[i, 1] = Convert.ToInt32(s1[1]);
            }
            int[] resenja = new int[m];
            for (int i = 0; i < m; i++)
            {
                resenja[i] = 0;

                string[] s1 = Console.ReadLine().Split();
                int l = Convert.ToInt32(s1[0]) - 1;
                int d = Convert.ToInt32(s1[1]) - 1;
                int x = Convert.ToInt32(s1[2]);

                resenja[i] = resiti(l, d, x, matrica);

            }
            for (int i = 0; i < m; i++)
            {
                Console.WriteLine(resenja[i]);
            }
            Console.ReadKey();

        }
    }
}