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

namespace Zadatak4
{
    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[] d = new int[n];
            int[] u = new int[n];

            for (int i = 0; i < n; i++)
            {
                s = Console.ReadLine().Split();
                d[i] = int.Parse(s[0]);
                u[i] = int.Parse(s[1]);
            }

            int[] l = new int[m];
            int[] r = new int[m];
            int[] x = new int[m];

            for (int i = 0; i < m; i++)
            {
                s = Console.ReadLine().Split();
                l[i] = int.Parse(s[0]);
                r[i] = int.Parse(s[1]);
                x[i] = int.Parse(s[2]);
            }

            for (int j = 0; j < m; j++)
            {
                int br = 0;
                
                for (int i = l[j] - 1; i < r[j]; i++)
                    if (x[j] >= d[i] && x[j] <= u[i]) br++;

                Console.WriteLine(br);
            }
        }
    }
}