using System;

namespace takmicenje
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] nm = Console.ReadLine().Split();
            int n = Convert.ToInt32(nm[0]);
            int m = Convert.ToInt32(nm[1]);
            int[,] a = new int[n, 2];
            int[,] b = new int[m, 3];
            for (int i = 0; i < n; i++)
            {
                string[] s = Console.ReadLine().Split();
                a[i, 0] = Convert.ToInt32(s[0]);
                a[i, 1] = Convert.ToInt32(s[1]);
            }
            for (int i = 0; i < m; i++)
            {
                string[] s = Console.ReadLine().Split();
                b[i, 0] = Convert.ToInt32(s[0]);
                b[i, 1] = Convert.ToInt32(s[1]);
                b[i, 2] = Convert.ToInt32(s[2]);
            }
            for (int i = 0; i < m; i++)
            {
                int k = 0;
                for (int j = b[i, 0] - 1; j < b[i, 1]; j++)
                {
                    if (b[i, 2] >= a[j, 0] & b[i, 2] <= a[j, 1])
                    {
                        k++;
                    }
                }
                Console.WriteLine(k);
            }
        }
    }
}