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

namespace D_Vage
{
    class Program
    {
        struct Tezina
        {
            public int l, r;
        }
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            Tezina[] a = new Tezina[n];
            for (int i = 0; i < n; i++)
            {
                s = Console.ReadLine().Split();
                a[i] = new Tezina { l = int.Parse(s[0]), r = int.Parse(s[1]) };
            }
            for (int i = 0; i < m; i++)
            {
                int b = 0;
                s = Console.ReadLine().Split();
                int l = int.Parse(s[0]);
                int r = int.Parse(s[1]);
                int x = int.Parse(s[2]);
                for (int j = l; j <= r && j < n; j++)
                {
                    if (a[j].l <= x && x <= a[j].r)
                    {
                        b++;
                    }
                }
                Console.WriteLine(b);
            }

        }
    }
}