using System;
using System.Collections.Generic;


class Scale
{
    public int lowerLimit;
    public int upperLimit;
    public Scale(int lower, int upper)
    {
        lowerLimit = lower;
        upperLimit = upper;
    }
    public bool checkWeight(int w)
    {
        return lowerLimit <= w && w <= upperLimit;
    }
}

class Program
{
    static void Main(string[] args)
    {
        string[] ulazNM = Console.ReadLine().Split(' ');
        int n = Convert.ToInt32(ulazNM[0]);
        int m = Convert.ToInt32(ulazNM[1]);
        List<Scale> scales = new List<Scale>();
        for(int i = 0; i < n; i++)
        {
            string[] ulaz = Console.ReadLine().Split(' ');
            int l = Convert.ToInt32(ulaz[0]);
            int r = Convert.ToInt32(ulaz[1]);
            scales.Add(new Scale(l, r));
        }
        int[] res = new int[m];
        for(int i = 0; i < m; i++)
        {
            res[i] = 0;
            string[] ulaz = Console.ReadLine().Split(' ');
            int l = Convert.ToInt32(ulaz[0]);
            int r = Convert.ToInt32(ulaz[1]);
            int x = Convert.ToInt32(ulaz[2]);
            for (int j = l - 1; j < r; j++)
                if (scales[j].checkWeight(x))
                    res[i]++;
        }
        for (int i = 0; i < m; i++)
            Console.WriteLine(res[i]);
    }
}