using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace VAGE
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int[] l;
            int[] k;
            int[] g;
            int[] h;
            int[] f;
            int n = Convert.ToInt32(s[0]);
            l = new int[n];
            k = new int[n];
            int m = Convert.ToInt32(s[1]);
            g = new int[m];
            h = new int[m];
            f = new int[m];
            int z = 0;
            for (int i = 0; i < n; i++)
            {
                string[] c = Console.ReadLine().Split(' ');
                l[i] = Convert.ToInt32(c[0]);
                k[i] = Convert.ToInt32(c[1]);
            }
            for (int e = 0; e < m; e++)
            {
                string[] r = Console.ReadLine().Split(' ');
                g[e] = Convert.ToInt32(r[0]);
                h[e] = Convert.ToInt32(r[1]);
                f[e] = Convert.ToInt32(r[2]);
            }
            for(int e = 0; e < m; e++)
            {
                z = 0;
                for (int I = g[e]-1; I < h[e]; I++)
                {
                    if (f[e] >= l[I] && f[e] <= k[I])
                    {                   
                    z = z + 1;                                           
                    }                    
                }
                Console.WriteLine(z);

            }
            
            Console.ReadLine();
        }
    }
}