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

namespace Vage
{
    class Program
    {
        static void vage(int n, int m, int[] d, int[] u, int[] l, int[] r, int[] x)
        {
            for (int i = 0; i < m; i++)
            {
                int k = 0;
                for (int j = l[i] - 1; j <= r[i] - 1; j++)
                {
                    if (x[i] >= d[j] && x[i] <= u[j])
                        k++;
                }
                Console.WriteLine(k);
            }
        }
        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]);
            }

            vage(n, m, d, u, l, r, x);
        }
    }
}