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

namespace Vaga
{
    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];
            int i;
            for (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 (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]);
            }
            int k = 0;
            i = 0;
            for (i = 0; i < m; i++)
            {
                int donja = l[i];
                int gornja = r[i];
                for (int j = donja; j < gornja; j++)
                {
                    if (x[i] < u[j] && x[i] > d[j])
                    {
                        k++;
                    }
                    Console.WriteLine(k);
                }
                k = 0;
            }
            Console.ReadLine();
        }
    }
}